load ascii data with multiple name
Mostrar comentarios más antiguos
dear all,
I have some data with name ZA000060.TXT, ZA000120.TXT, ZA000180.TXT ..... at the same time I load data with :
for k=60:60:300
aa = sprintf('%d',k);
load (['ZA0000' aa '.TXT'],'AAA')
end
but there is error when load second data because the zero number.
unable to read file "ZA0000120.TXT"
Any help would be great,
Best regard,
5 comentarios
@gugum gumbira : Why do you think that " error when load second data because the zero number" ?
You don't give us the complete error message, and there is no reason why a zero digit in a filename would cause any error. Please show us the complete error message.
Also note that it would be much better to load the data into one cell array:
V = 60:60:300;
C = cell(size(V));
for k = 1:numel(V)
filename = sprintf('ZA000%03d.TXT', V(k));
C{k} = load(filename);
end
Do NOT load the variables individually, this will make your code much more complicated.
Edit: simplify example code.
gugum gumbira
el 13 de Abr. de 2016
gugum gumbira
el 15 de Abr. de 2016
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!