Problem reading real-time data from an excel file
4 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm having trouble reading from an Excel file. I'd trying to read real-time data about every second.
But, it reads something, but the data are not updated. In other words, it reads the same value over & over -- no updating is done. I'm using Windows 7 with this command ...
r = xlsread('C:\Users\DN\Desktop\qx.xlsx', 1, 'C5:O5')
When I do ...
[fid, status] = fopen('C:\Users\DN\Desktop\qx.xlsx','rt')
it gives me
fid = 3 & status = '' does this mean anything?
Any help will be greatly appreciated,
Thanks
Damo Nair
0 个评论
回答(1 个)
Walter Roberson
2017-12-18
You appear to be using MS Windows. I suspect you have Excel installed. xlsread() uses ActiveX connections to Excel to read data in the case of MS Windows with Excel installed. If you are using one of the last few releases, then xlsread caches connections to reduce overload instead of opening and closing the same file each time. That is probably causing problems for you.
In cases where you are reading the same file over and over again, you are probably better off using ActiveX directly. You can even create callbacks to get notified when the data changes.
In the meantime, try adding the option 'basic' to your xlsread() command; that will force it to read the file as a text file instead of using ActiveX to ask Excel for the data.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!