Read double datas
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Titus Edelhofer
le 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 commentaires
Walter Roberson
le 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 commentaires
Voir également
Catégories
En savoir plus sur Low-Level File I/O dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!