how to Access data from a file?

1 次查看(过去 30 天)
Gokul
Gokul 2013-4-5
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 个评论
Jan
Jan 2013-4-5
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?

请先登录,再进行评论。

回答(1 个)

Jan
Jan 2013-4-5
Perhaps, but this is based on guessing only, you want:
vox = double(rand(1, 100) > 0.5); % Invented test data
plot(vox, '.');

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by