fopen problem How does it work?
Mostra commenti meno recenti
I have a file VarName3.txt like this:
[2.281000003
2.593500003
2.749750003
3.062250003
3.062250003...
and negative values too. It is 1x1000.
The code I am using is:
fid=fopen('VarName3.txt','r');
atensao=fread(fid,'float');
fclose(fid);
When I type in Comand Window to check atensao, the answer is:
1.0e-03 *
0.0425
0.0000
0.0000
0.0006
0.0000...
Why it doesn't work? What am I doing wrong? Could someone teach me? Thanks a lot.
Risposta accettata
Più risposte (1)
Walter Roberson
il 10 Feb 2014
0 voti
If you are reading text you should not be using fread() which is for reading binary files.
Have a look at fscanf(). Also have a look at textscan()
1 Commento
André Luiz Regis Monteiro
il 11 Feb 2014
Categorie
Scopri di più su Data Type Conversion in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!