Problem reading real-time data from an excel file

6 次查看(过去 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

回答(1 个)

Walter Roberson
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.
  1 个评论
Damo Nair
Damo Nair 2017-12-18
Thanks for your reply Walter.
So, I just tried using the 'basic' option & it read something but wasn't updating. It also gave me the following message ...
Warning: XLSREAD has limited import functionality on in basic mode. Refer to HELP XLSREAD for more information. > In xlsread at 168 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 181
I think I installed Excel in 2014/2015. I also tried save the Excel file as a '95 version. Nothing doing.
May be I can read it using fopen/textscan?
Thanks Damo.

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by