Struggling to store indexing variable as an array.
이전 댓글 표시
I am trying to store a list of file names which have been retrieved from a folder.
Any help would be appreciated; here is what I have so far:
File = zeros(1,10);
for i=1:10
File(1,i) = sprintf('%s%05d%s', 'A', i, '.dat');
end
I get the error message: "Subscripted assignment dimension mismatch."
I would like the files to be stored as:
File = [A00001.dat A00002.dat ... A0000N.dat]
Hopefully it is clear what I'm trying to achieve.
If I use the code:
File = zeros(1,10);
for i=1:10
File = sprintf('%s%05d%s', 'A', i, '.dat');
end
It runs; however, it only stores the final File name (in this case, "A00010.dat") rather than a 1x10 array of the first 10 File names.
Thanks
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!