Progress of calculation

15 ビュー (過去 30 日間)
john
john 2012 年 6 月 16 日
Hi, if I press pushbutton, then I calculate matrix "result" like
matrix =[A B C D; E F G H, I J K L];
result=(simple(matrix\Z));.
Is possible to show progress of this calculation? Progress begin, if I press the button and stop if calculation is stop. I found this code, but it's not what I realy need because bar is independent on the calculation.
h = waitbar(0,'Please wait...');
steps = 1000;
for step = 1:steps
% computations take place here
waitbar(step / steps)
end
close(h)
Time of calculation is not the same, it is variable.

採用された回答

Walter Roberson
Walter Roberson 2012 年 6 月 16 日
If you do not have any information about how long the calculation "should" take, and you do not have access to the source to put in hooks to update progress information based upon internal knowledge of how far the algorithm has gotten, then NO, you cannot create any kind of progress bar.
You can create visual feedback that the computation is not yet finished (a "spinner" or "hourglass"), but without one of the two pieces of information I mention above, you cannot know how far it has gotten or whether it will finish at all.
  4 件のコメント
john
john 2012 年 6 月 18 日
If I press button, I want to set text on the begin of the program as you can see. Than follow calculation. On the finish I want to set text "calculating done"
{function pushbutton_Callback(hObject, eventdata, handles)
set(handles.text5,'string','calculating start')
.
.
matrix =[A B C D; E F G H, I J K L];
result=(simple(matrix\Z));
.
.
set(handles.text5,'string','calculating done')}
But I never see calculating start...It seem like bushbutton makes all sets on the end of the function. But how can I do, what I need?
Walter Roberson
Walter Roberson 2012 年 6 月 18 日
After the set(), call drawnow()

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by