Most memory efficient way to plot 1M lines?

I am plotting almost 1 million lines in a loop and Matlab uses over 10gb of memory.
Is there a way to reduce the memory hit but still be able to plot my lines?
Here is my code (edited to use less memory)
clear all
close all
clc
figure
hold on
xlabel('what')
ylabel('eva')
data = rand(1000);
for a = 1:1000000
% plot
plot(data)
end

댓글 수: 3

I don't understand your motivation. A single invocation of
plot(data)
in your example produces 1000 Lines (with 1000 points each) which cannot be interpreted by eye in any meaningful way. You call this a million times, creating a billion lines in a plot each with 1000 points...This will just use loads of resources without revealing anything.
rand(1000)
is not a line of data, it is a 1000 * 1000 array of data. I keep making this mistake (if it was a mistake in your case) when meaning to create a vector, forgetting the default behaviour of these functions with one argument is to produce an n * n square matrx, not an n * 1 or 1 * n vector.
Massimo Zanetti
Massimo Zanetti 2016년 10월 21일
Decimate your data, if the problem is the number of points to be plotted.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

태그

질문:

2016년 10월 21일

댓글:

2016년 10월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by