Struggling to store indexing variable as an array.
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!