Textscan Reads Only the first 3 numbers
이전 댓글 표시
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
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
2022년 9월 26일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
