fopen problem How does it work?
Afficher commentaires plus anciens
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.
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 10 Fév 2014
0 votes
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()
Catégories
En savoir plus sur Data Type Conversion dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!