Jan 7, 2014 #1 S 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?
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?
Jan 7, 2014 #2 P phobos1 Full Member level 2 Joined Jan 18, 2010 Messages 135 Helped 15 Reputation 30 Reaction score 15 Trophy points 1,298 Location Salem, Tamil Nadu, India Activity points 2,112 try textread matlab cmd.......
Jan 7, 2014 #3 Dominik Przyborowski Advanced Member level 4 Joined Jun 6, 2013 Messages 1,210 Helped 504 Reputation 1,013 Reaction score 506 Trophy points 1,393 Location Norway Activity points 9,311 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
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
Feb 28, 2014 #4 W weetabixharry Full Member level 4 Joined Oct 9, 2013 Messages 232 Helped 69 Reputation 142 Reaction score 73 Trophy points 1,318 Location Sweden Activity points 3,462 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.
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.