Skip data files while reading input and writing output in matlab code
Mostrar comentarios más antiguos
I use matlab code to read several files and write output in the following way:
n=202;
for idx = 0:n
infilename = sprintf('pt%d.txt',idx);
outname = sprintf('out%d.txt',idx);
Now if some arbitrary data files are missing e.g. pt20.txt, pt50.txt ,etc then the code is terminated. I would like to modify the code in a way that if some data files are not found then the code would skip them and proceed to reading/writing the next available data file.
Thank you.
Respuestas (1)
Azzi Abdelmalek
el 17 de Jun. de 2015
Editada: Azzi Abdelmalek
el 17 de Jun. de 2015
infilename = sprintf('pt%d.txt',idx);
if exist(infilename)
%do
end
2 comentarios
Sabbir
el 17 de Jun. de 2015
Editada: Walter Roberson
el 18 de Jun. de 2015
Azzi Abdelmalek
el 17 de Jun. de 2015
yes, it was just a typo
Categorías
Más información sobre Logical 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!