How to read spreadsheet files iteratively?
조회 수: 4 (최근 30일)
이전 댓글 표시
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
채택된 답변
per isakson
2020년 5월 9일
Replace
readtable('filename.xls');
by
readtable( [ filename, '.xls' ] );
to use the value of the variable not its name.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!