Import data from text file

1 view (last 30 days)
Rica on 11 Sep 2017
Edited: KL on 11 Sep 2017
Hi, i want to import data from a text file. the text is consisted of 201 column. The first column is a time column:
the oder 200 column are floting number. is textscan the approprite function to do this? Schould i specifiy the Format of all the 201 clumns, or is there any tricky function?
Thank you!

Accepted Answer

Guillaume on 11 Sep 2017
use readtable which should be able to figure out the format of your file on its own. It will probably fail for your time column and import it as text instead. This can be fixed either beforehand by overriding the import options or afterward with:
yourtable.yourfirstcolumn = datetime(yourtable.yourfirstcolumn, 'InputFormat', '', 'Format', '');
  1 Comment
KL on 11 Sep 2017
Edited: KL on 11 Sep 2017
I agree! readtable(filename) should be enough if that file is properly formatted.

Sign in to comment.

More Answers (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!