fopen problem How does it work?
Show older comments
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.
Accepted Answer
More Answers (1)
Walter Roberson
on 10 Feb 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()
1 Comment
André Luiz Regis Monteiro
on 11 Feb 2014
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!