Create a matrix with a text file- how to specify data I want in the matrix?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Marian
am 4 Okt. 2013
Kommentiert: Marian
am 7 Okt. 2013
I would like to specify which data I want read in from a large textfile. The first bit of data is a string, such as "2011-02-03 05:28:10" (quotations included). How would I read in and create a matrix using only bits of data that begin with 2011-02 (ie data from Feb 2011)? The data is in chronological order in the text file, so if there is some beginning and ending parameterization I could use, that would work as well.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 5 Okt. 2013
fgetl() a line. strcmp() the target date to the beginning of the line. If it is there, use the line; otherwise skip the line if you have not had any successful lines yet. If you have had successful lines and the new line does not match, stop reading because no further records can be in range.
Weitere Antworten (1)
dpb
am 5 Okt. 2013
Generally it's much simpler to just read the file then select the subset desired for further manipulation.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Text Files finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!