Reading a excel spread sheet
Mostrar comentarios más antiguos
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?
Respuestas (2)
Azzi Abdelmalek
el 27 de Dic. de 2012
Editada: Azzi Abdelmalek
el 27 de Dic. de 2012
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
el 27 de Dic. de 2012
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.
Categorías
Más información sobre Spreadsheets en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!