Could we add variable in folder directory ??

I want to access several sequenced folders
Example :
[ndata, text, alldata] = xlsread('D:\folder\1\file');
[ndata, text, alldata] = xlsread('D:\folder\2\file');
[ndata, text, alldata] = xlsread('D:\folder\3\file');
[ndata, text, alldata] = xlsread('D:\folder\4\file');
Could I replace 1,2,3and 4 by variable i .. How could the directory be written here ?!!

 채택된 답변

Jason Ross
Jason Ross 2012년 3월 13일

1 개 추천

댓글 수: 1

Jan
Jan 2012년 3월 13일
Or explicitely:
for k = 1:4; xlsread(['D:\folder\', sprintf('%d', k). '\file']); end

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by