Change input name when running a script
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi everybody,
I'm trying to change the input name but I can't get it to work. Basically, what I want to do is changing the autoname below for each run:
load('test1.mat');
load('test2.mat');
names = {'test1', 'test2'};
for autoname = 1:length(names)
All_numbs=autoname;
end
So it ends up being different matrices called at each iteration.
Thanks in advance.
Best regards,
Christian
댓글 수: 0
채택된 답변
Henrik
2014년 12월 7일
I'm not sure what you're asking, but does this help?
names={'test1', 'test2'};
for k=1:length(names)
autoname=names{k};
load(autoname);
% or you can do load(['names{k} '.mat']);
end
댓글 수: 3
Image Analyst
2014년 12월 7일
편집: Image Analyst
2014년 12월 7일
I don't understand what you're doing. Why didn't you do what Henrik suggested? That will let you specify a filename using an index from a predefined list of filenames.
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Signal Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!