How to read spreadsheet files iteratively?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Adarsh Vasa
am 9 Mai 2020
Kommentiert: Adarsh Vasa
am 9 Mai 2020
I am trying to access .xls files that are indexed in the following approach:
for a=1:5
filename = sprintf('%s_%d','Set_90',a);
fname=readtable('filename.xls');
But obviously, 'readtable' function is calling a file named 'filename.xls' and not 'Set_90_1.xls' . How do I change the code, in order to call the latter?
Thanks.
0 Kommentare
Akzeptierte Antwort
per isakson
am 9 Mai 2020
Replace
readtable('filename.xls');
by
readtable( [ filename, '.xls' ] );
to use the value of the variable not its name.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu File Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!