Execute functions automatically

Dear all, I have a problem: I have to execute for 1000-2000 times a command like: wavef1=Readwav('ch1probe001.trc'), wavef2=Readwav('ch1probe002.trc'), wavef3=Readwav('ch1probe003.trc'), etc. Any suggestion? I don't know if I can use a for cicle wavef(k)=Readwav('ch1probe(k).trc') for k=001:1:1000...

 채택된 답변

Daniel Shub
Daniel Shub 2011년 7월 19일

0 개 추천

This is basically FAQ 4.6
You really do not want to do this. You can use cell arrays to accomplish something very similar:
wavef = cell(1000, 1);
for ii = 1:1000
wavef{ii} = redwav(['ch1probe', num2str(ii), '.trc']);
end
Note the {} to make a cell array.

댓글 수: 1

Giulia De Luca
Giulia De Luca 2011년 7월 19일
Thank you Daniel, honestly is the first time that I use {}: I really thank you for your complete answer.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by