How can I read data from certain range in txt file in matlab?

3 Ansichten (letzte 30 Tage)
Hi,
I would like to read from line 85 to line 1108 in txt file in matlab.
I don't know how to do it.
The data from line 85 to line 1108 looks like this:
I have 1024 data.
Can please anybody help me?
Thanks,
Hung Jr

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 18 Aug. 2016
Use textscan() with HeaderLines set to 84, a format of '%f%f%f', and specify a count of (1108-85+1)
  3 Kommentare
Walter Roberson
Walter Roberson am 18 Aug. 2016
fid = fopen('YourFile.txt', 'rt');
datacell = textscan(fid, '%f%f%f', (1108-85+1), 'HeaderLines', 84, 'CollectOutput', 1);
fclose(fid);
YourInput = datacell{1};
Hung Jr Chen
Hung Jr Chen am 18 Aug. 2016
Hi Walter,
Thanks it really works ! :D
Thank you,
Hung Jr

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by