Struggling to store indexing variable as an array.
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!