Why does it take MATLAB a long time to plot 150x1800 data?

I have the following data in my workspace:
X: 1x1800 double
Y: 150x1800 double
Why does it take a long time for me to plot this:
>> figure; hold on
>> for n=1:150
>> plot(X,Y);
>> hold on
>> end
Furthermore, MATLAB will freeze when I try to interact with the figure that is generated

 採用された回答

MathWorks Support Team
MathWorks Support Team 2018 年 8 月 17 日

0 投票

You might have accidentally plot your entire data 150 times.
(i.e. notice that you are plotting 150x in a for-loop of the same 150x1800 data points)
Therefore, this would significantly use more memory and, unsurprisingly, reduce graphic performance.
Removing the for-loop from your script would achieve the same figure with less figure creation time, less memory usage and improved interactivity performance:
>> figure
>> plot(X,Y);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by