fopen problem How does it work?
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 10 de Feb. de 2014
0 votos
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 comentario
André Luiz Regis Monteiro
el 11 de Feb. de 2014
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!