readmatrix issue with multiple sheet excel
6 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I am using readmatrix to access data that is stored in an Excel file. This excel file has two sheets, so I am using the following comand to access it:
SF_Data = readmatrix('LMS_Corrected','UseExcel',1,'Sheet',2);
However when I run the code it sometimes fails in this line and the console outputs the following message:
[spreadsheet_err]: Could not parse
a valid range from the given
string. A valid range is of the
form 'A1' (cell), 'A:B'
(column-select), '1:5' (row-select)
or 'A1:B5' (rectangle-select).
It fails randomly, sometimes the code will work, sometimes it will get stuck here. I have found a way around it which is to print a variable after that line, or to write that line again, without changing anything, at it works (for a couple of runs, then it will fail again). Any reason why this might be happening?
I have also tried to change the 'Sheet' parameter to the name of the sheet instead of its number, but the issue remains.
Thank you,
0 件のコメント
回答 (1 件)
Walter Roberson
2020 年 11 月 13 日
My suspicion about what is happening is that the Excel process is busy. Sometimes you have to pause() briefly... sometimes up to 5 seconds but usually less... for Excel to finish what it is doing, if you are doing several Excel operations in a row.
The way to avoid that would be to 'UseExcel', 0 so that it never talks to Excel at all.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!