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...

 Accepted Answer

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 Comment

Thank you Daniel, honestly is the first time that I use {}: I really thank you for your complete answer.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!