Reading a excel spread sheet
古いコメントを表示
I am new to MATLAB. I want the script that creates a loop to read columns of spread sheet. For example read column A and B, then column A and C, then column A and D.
Then is it possible for the script to name and save files according to dimensions specified in the spreadsheet?
回答 (2 件)
Azzi Abdelmalek
2012 年 12 月 27 日
編集済み: Azzi Abdelmalek
2012 年 12 月 27 日
Use xlsread function to read excel files, to name files according to a number k, use sprintf command
k=2
filename=sprintf('fil%d',k)
Image Analyst
2012 年 12 月 27 日
It's best not to read columns in a loop. It's better to just read the whole worksheet into MATLAB all in one call to xlsread because each time you call xlsread it has to launch Excel get the numbers out, and then shut down Excel, which can take a long time if you have to do it more than twice or so. If you really want to do it that way, then it's best if you just open it once with ActiveX, then you can read as many things as you want in individual calls very quickly, and then shut down Excel once after you're done with all your reads. To create cell references for doing that, you use sprintf():
cellReference = sprintf('A%d:D%d', startingRow, endingRow);
You can search this forum for ActiveX demos for Excel - I know I've posted them, and other have too.
カテゴリ
ヘルプ センター および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!