필터 지우기
필터 지우기

Problem reading real-time data from an excel file

조회 수: 6 (최근 30일)
Damo Nair
Damo Nair 2017년 12월 18일
댓글: Damo Nair 2017년 12월 18일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by