how to Access data from a file?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello ,
I did not understand which command to use.i.e to use fscanf or any thing else?
I opened a text file as
fid_txt=fopen('fname.txt','w+');
I have written data onto a text file as shown below
fprintf (fid_txt,'%d %d \n',frame,vox(frame));
The above line repeats as it is in loop.
The "frame" is the frame number (integer) and "vox(frame)" acts as a switch. i.e. for example
vox(100)=1
vox(254)=0......
the value is either 1 or 0.
and finally closed the file.
Now the question is
1)how do i have to plot down the vaues of vox i.e. 1 or 0 but not the frame number.
2)how to plot ? The plot should be in a digital format,i.e "ON" for a frame and "OFF" for the other.It Should not be as a saw tooth display.
Kindly help me !! as i am new to matlab
Thanks in advance
1 comentario
Jan
el 5 de Abr. de 2013
Do I understand correctly that the problem has no connection to the method to write the file? Why do you post the code for writing the file then?
Do you mean, that it is possible to answer the question "how do I have to plot the values"? How could we know an answer?
What is a "plot" in a "digital format"? Are there any "analog formats" on a computer? Does "ON" mean a string? Or do you want to get single dots without a connection?
Respuestas (1)
Jan
el 5 de Abr. de 2013
Perhaps, but this is based on guessing only, you want:
vox = double(rand(1, 100) > 0.5); % Invented test data
plot(vox, '.');
0 comentarios
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!