Can a GUI timer be made to regularly update during long calculations?

1 回表示 (過去 30 日間)
Tim Lewis
Tim Lewis 2012 年 10 月 15 日
I have a GUI that runs a program that takes anywhere between a few minutes and a few hours to run and I would like to add a timer to the GUI so I can see how long the program has been running since it started. The program spends the majority of its time in the Symbolic Math Toolbox (~90%), and there are no significant portions of time spent in a loop during execution.
In order to accomplish this (in a way that updates regularly without slowing the original program down), I believe the Parallel Computing Toolbox would have to be utilized, but I don't have any experience with this.
Is there anyone here that might know how this could be accomplished, or if it's even possible?

採用された回答

Sean de Wolski
Sean de Wolski 2013 年 1 月 4 日
Hi Tim,
You could use a timer on the main thread and then use batch() (from PCT) to run the feval() command on a worker(s) that was opened with matlabpool()
  1 件のコメント
Tim Lewis
Tim Lewis 2013 年 2 月 12 日
That may work. I will have to give it a try. Thanks for your help!

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

その他の回答 (1 件)

Loren Dean
Loren Dean 2013 年 1 月 4 日
The timer object in MATLAB (>> help timer) is probably your best bet. Just initialize it when the GUI launches or the program starts and then have it callback to display the runtime.
  1 件のコメント
Tim Lewis
Tim Lewis 2013 年 1 月 4 日
Thanks for your reply!
I don't think the timer function can run in parallel with another function apart from the Parallel Computing Toolbox. This is basically what needs to happen since probably 90% of the calculation time is spent in the following commands:
feval(symengine,'reset');
feval(symengine,'read','"MyProgram.mu"');
Where "MyProgram.mu" is the name of a user-defined MuPAD procedure file being evaluated by Matlab's Symbolic Math Toolbox.
Therefore, I believe that I need to be running the timer function in parallel with the main calculation, but I do not have enough experience with the Parallel Computing Toolbox to be able to figure this out. I was hoping that someone on here might be able to help me.

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by