Skip data files while reading input and writing output in matlab code
이전 댓글 표시
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.
답변 (1개)
Azzi Abdelmalek
2015년 6월 17일
편집: Azzi Abdelmalek
2015년 6월 17일
infilename = sprintf('pt%d.txt',idx);
if exist(infilename)
%do
end
댓글 수: 2
Sabbir
2015년 6월 17일
편집: Walter Roberson
2015년 6월 18일
Azzi Abdelmalek
2015년 6월 17일
yes, it was just a typo
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!