Read double datas
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dears,
I want to read .txt file that includes too many double type datas. ex) 1.2039 0.3944 1.4595 ... 2.5434 ... ...
I used 'fscanf' function to read this file. But, this txt file have too many entry, thus, I want to read this file from a specific position. How can I read this file from the given position?
Thanks,
0 Kommentare
Antworten (2)
Titus Edelhofer
am 19 Jan. 2012
Hi,
with fscanf you need not read all data at once but might read only N numbers (take a look at the doc). Use ftell and fseek to read the current position in the file and for moving the file pointer to that position later.
Titus
0 Kommentare
Walter Roberson
am 19 Jan. 2012
There is no way to select a specific position in a text file, other than to have already read through the text file and recorded all the potential positions of interest.
In particular there is no way to go directly to a specific line number or a specific field number within a line.
If your data file was in binary format and was all one data type, and all the sizes were consistent, then it would be possible to go directly to particular entries.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Low-Level File I/O 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!