Textscan Reads Only the first 3 numbers
Show older comments
Hello,
I´m trying to read this .txt (attached) file and store the values (54 columuns).
This is the code that I´m using
Name_1 = 'fffff.txt';
fid = fopen(Name_1,'r');
cell_data1= textscan(fid,'%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f','Delimiter','','headerLines',6,'CollectOutput',1);
fclose(fid);
But unfortunately the code is messing with the first two columns (data and time).
This is what it stores.

How can I skip those two and just store the remaining 52 columns?
Thanks in advance
2 Comments
Look at the file —
C1 = readcell('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1136490/fffff.txt')
There does not appear to be anything in the file (other than a few dates and some integer values). There are 6 header lines, then a date (best read as a string or as a date — see Nonnumeric Fields in the formatSpec section of the documentation) and a single integer.
Fabio Taccaliti
on 26 Sep 2022
Accepted Answer
More Answers (0)
Categories
Find more on Text Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!