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