Info

This question is closed. Reopen it to edit or answer.

help with syntax of textread

1 view (last 30 days)
Britta
Britta on 4 Mar 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
hello,
I am new to MATLAB.
I need to import a text file with text and numbers. Four delimiters: forward slash, space, colon, comma. (or I suppose you could view that as just 1 delimiter, the comma, and then I could break apart the date and time later. But I would prefer doing that all in one step.)
I do not particularly want the headings, which appear in the first row. The data in the subsequent rows currently appears as Date Time,Data. e.g.
row 2: 3/2/2014 10:28:00 AM,4,1944,136,24.41,354066,24.61,24.64,24.53,24.29
I would like each value in each row to occupy its own column:
row 2: 3 2 2014 10 28 00 AM 4 1944 136 24.41 354066 24.61 24.64 24.53 24.29
thanks for your help!
  2 Comments
Jan
Jan on 4 Mar 2015
You've found the documentation of textread already. So please post, what you have tried so far and explain, which problems occur.
per isakson
per isakson on 5 Mar 2015
Edited: per isakson on 5 Mar 2015
  • which release of Matlab do you use? Recently, new features to parse datetime appeared.
  • use textscan rather than textread according to recommendations by Matlab
  • do you really want to split datetime into seven columns, &nbsp 3 2 2014 10 28 00 AM ? &nbsp Why?

Answers (0)

Community Treasure Hunt

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

Start Hunting!