MATLAB Answers

matlab crash

1 view (last 30 days)
vsee
vsee on 30 Aug 2011
Hello
When I try to load a signal of 10 million data points and plot it, the plot goes through fine but I can't add data cursors to it. When I reduce the number of data points to 7 million, everything works fine.
[anasignal,path] = uigetfile('*.csv','Select the .csv file to analyze');
if isequal(anasignal,0)
disp('User selected Cancel');
end
asig = csvread(fullfile(path, anasignal),15,0);
prompt = {'Enter the starting point:','Enter the ending point:'};
dlg_title = 'Enter the limits';
num_lines = 1;
def = {'1','2'}; %default values for the inputs
answer = inputdlg(prompt,dlg_title,num_lines,def);
ErrStatus=0;
if isempty(answer)
disp('User canceled the input')
ErrStatus=1;
else
if (strcmp(answer{1},'') || strcmp(answer{2},'')) %empty strings
disp('Error: Empty inputs not allowed')
ErrStatus=1;
else
ulimit=str2double(answer(2));
llimit=str2double(answer(1));
end
end
if isempty(ulimit) || isempty(llimit) %empty array
disp('Error: Empty inputs not allowed')
ErrStatus=1;
end
%you might also need to verify the size of the inputs
if numel(ulimit)>10000000 || numel(llimit)<1 %empty array
disp('Error: Arrays not allowed')
ErrStatus=1;
end
aamp = asig(llimit:ulimit-1,2);%vary this to get more samples
ts = asig(2,1) - asig(1,1);%sampling rate calculated automatically
tim = [llimit-llimit:ulimit-llimit - 1]*ts;%vary this in accordance with aamp
time = tim';%transposed to get a column vector for plotting
ax1 = subplot(2,1,1);plot(time, aamp);
asig happens to be a .csv file with 10 million data points. I can control the number of points to plot by the variables ulimit and llimit. Is this a memory problem? asig happens to be an array of double's using up 160000000 bytes in memory. Can I improve this by converting asig to another data type without losing information?
On a separate note, I am reading the .csv file which I took from an oscilloscope. The Oscilloscope puts out a lot of unwanted information before the data starts appearing from row 15. Thats why I have to say
asig = csvread(fullfile(path, anasignal),15,0);
in my code. Is there a way to avoid this?
Thanks

Answers (1)

Daniel Shub
Daniel Shub on 2 Sep 2011
The highest resolution monitors (2560x1440) only have 3.6 million pixels. Assuming MATLAB would plot each data point as a single pixel, and it won't, you would need at least 3, and maybe as many as 4000, monitors. In other words, MATLAB isn't really plotting all your data points.

Tags

Products

Community Treasure Hunt

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

Start Hunting!

Translated by