Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

plotting values from a file

Status
Not open for further replies.

sureka

Newbie level 5
Joined
Dec 16, 2013
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
55
i have a file in .txt format with about 1000000 values..can anyone please help me with a matlab code to plot the data between 100th value to 1000th value?
 

If You don't need to used matlab, in gnuplot 4.4 or newer it is easy with one command:
plot for [n=100:1000] 'datafile.txt' u 1:n
 
  • Like
Reactions: sureka

    sureka

    Points: 2
    Helpful Answer Positive Rating
What format is the data in? Assuming it's floating point data, you can read the whole file using:
Code:
fid = fopen('filename.txt');
x = fscanf(fid,'%f');
fclose(fid);
So, to plot the data between 100th value to 1000th value, you can use something like:
Code:
fid = fopen('filename.txt');
fscanf(fid,'%f',100);
x = fscanf(fid,'%f',900);
fclose(fid);
plot(x);

To look at the different options available to you, type "help fscanf" into Matlab.
 
  • Like
Reactions: sureka

    sureka

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top