Problem with textscan function

2 ビュー (過去 30 日間)
Nataliia Solomina
Nataliia Solomina 2015 年 1 月 16 日
回答済み: Geoff Hayes 2015 年 1 月 19 日
I have a file with such text and I need to extract data from it, how can I perform this? Would you be so kind to help me. Thank you!

回答 (1 件)

Geoff Hayes
Geoff Hayes 2015 年 1 月 19 日
Nataliia - it would have been easier if you attached a sample file, because it is unclear if there are more than the 8 columns that you have shown above.
However, if there are just eight columns and each is separated by a tab, then you could use textscan as
fid = fopen('myDataFile.txt');
[data] = textscan(fid,'%f\t%s\t%f\t%f\t%f\t%f\t%f\t%f\n');
fclose(fid);
Try using the above code and see what happens. Hopefully, data will be a cell array with eight columns of data (with the second being an array of strings, for the time data).

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by