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

 Respuesta aceptada

Daniel Shub
Daniel Shub el 19 de Jul. de 2011

0 votos

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 comentario

Giulia De Luca
Giulia De Luca el 19 de Jul. de 2011
Thank you Daniel, honestly is the first time that I use {}: I really thank you for your complete answer.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming 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!

Translated by