フィルターのクリア

Matlab Runs Slower during each consecutive iteration

5 ビュー (過去 30 日間)
Ryan
Ryan 2011 年 5 月 26 日
I have a simulation that i built that I run multiple time inside a for(or parfor) loop. I timed each iteration and noticed that it takes longer to complete each consecutive iteration. I have preallocated all my arrays so I know its not that.
Also, of concern is that if I finish it and re-run the simulation it will not start again at the faster speeds but run slowly, almost as if it picked up where it left off. But if I close matlab, log off windows, log back on, and re run it. I will start off running faster again.
I was wondering if there was some sort of memory that ends up filling up in matlab ans if so is there a way to clear it to run these simulations faster (without logging off windows).
Thank you,
Ryan
  1 件のコメント
Edric Ellis
Edric Ellis 2011 年 5 月 26 日
Could you clarify: what form is this simulation? (MATLAB code, Simulink model, ...) Does "clear classes" help things? Do you have persistent/global data anywhere? Do you really need to log off Windows to get back to the "fast" state - is it not sufficient simply to restart MATLAB? Have you checked that you're not increasing the size of your pre-allocated arrays?

サインインしてコメントする。

回答 (3 件)

Jan
Jan 2011 年 5 月 27 日
Use the PROFILEr to find out, which lines take more time from interation to iteration.
As long as you do not find the actual slow part of the program, all our answers are wild mass guessing. See: PMWiki: WildMassGuessing

Clemens
Clemens 2011 年 5 月 27 日
One thing that happens often to me is that I forget to close invisible windows. (created by figure('visible','off') )
maybe try a:
close all
  1 件のコメント
Jan
Jan 2011 年 5 月 27 日
A similar problem appeared in this forum before: Images are added to an AXES, but the former images have not been deleted.

サインインしてコメントする。


Ryan
Ryan 2011 年 5 月 26 日
This is a MATLAB code.
I'll give the clear classes a try.
No global or persistent variables are used.
The log off is required.
I've gone through and made sure I've pre-allocated all my arrays but I'll check again.
  1 件のコメント
Daniel Shub
Daniel Shub 2011 年 5 月 27 日
Does your program call any mex files or launch any processes external to MATLAB? What about file/IO read and writes?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeParallel for-Loops (parfor) についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by