load ascii data with multiple name
이전 댓글 표시
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
@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
2016년 4월 13일
gugum gumbira
2016년 4월 15일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!