header = 9;
delimiter = '\t';
for i = 1:2
filname = ['H1','2_I1sv00001 -',num2str(i),".txt"];
dat =importdata(filname,delimiter,header);
end
Error using importdata
Unable to open file.

 채택된 답변

Rik
Rik 2023년 3월 14일

1 개 추천

You didn't form the file names properly, so you were trying to read files that don't exist. You're also overwriting the results.
header = 9;
delimiter = '\t';
for i = 1:2
filname = sprintf('H1, 2_I1sv%05d.txt',i);
dat(i) =importdata(filname,delimiter,header);
end
dat
dat = 1×2 struct array with fields:
data textdata colheaders

댓글 수: 1

AL
AL 2023년 3월 14일
Dear Rik,
Thank you so much. Have a wonderful week.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

제품

릴리스

R2022b

질문:

AL
2023년 3월 14일

댓글:

AL
2023년 3월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by