Error in import data

4 Ansichten (letzte 30 Tage)
AL
AL am 14 Mär. 2023
Kommentiert: AL am 14 Mär. 2023
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.

Akzeptierte Antwort

Rik
Rik am 14 Mär. 2023
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 Kommentar
AL
AL am 14 Mär. 2023
Dear Rik,
Thank you so much. Have a wonderful week.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by