Error in import data

7 次查看(过去 30 天)
AL
AL 2023-3-14
评论: AL 2023-3-14
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
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 个)

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by