Textscan Reads Only the first 3 numbers

1 ビュー (過去 30 日間)
Fabio Taccaliti
Fabio Taccaliti 2022 年 9 月 26 日
コメント済み: Geoff Hayes 2022 年 9 月 26 日
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 件のコメント
Fabio Taccaliti
Fabio Taccaliti 2022 年 9 月 26 日
This is how it looks like :)

サインインしてコメントする。

採用された回答

Geoff Hayes
Geoff Hayes 2022 年 9 月 26 日
@Fabio Taccaliti - perhaps instead you can use readtable to read the table from file and then extract the data you need. For example,
filename = 'fffff.txt';
tableData = readtable(Name_1,'Delimiter','\t','headerLines',6);
data = tableData(:,3:end);
  4 件のコメント
Geoff Hayes
Geoff Hayes 2022 年 9 月 26 日
There must be some invalid data in one of your date or time columns. You may need to glance through the data to figure out which field is invalid. Or exclude those columns altogether (which I thought is what you wanted to do?).

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Find more on Large Files and Big Data 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!

Translated by