How to update the result after each iteration in uitable?

3 ビュー (過去 30 日間)
Tien Tran
Tien Tran 2016 年 5 月 7 日
コメント済み: Tien Tran 2016 年 5 月 7 日
I want to save and update values calculated in each iteration of a loop into uitable to display on GUI. I have tried to use syntax: data = [x y]; set(handles.uitable,'Data',data); but it didn't actively. There are files I have used to perform in untitled.m. Can experts help me?

採用された回答

Image Analyst
Image Analyst 2016 年 5 月 7 日
I didn't run your code but the usual culprit if your GUI is not updating immediately is that you're in a really intensive loop and the GUI doesn't have time to update because it's too busy doing other stuff in the loop. The solution is to call drawnow
drawnow;
after each call to set() to send the new data to the uitable control.

その他の回答 (1 件)

Tien Tran
Tien Tran 2016 年 5 月 7 日
編集済み: Tien Tran 2016 年 5 月 7 日
I have checked my code. I still run well, but it take a long time for a loop (about 5 minutes). The result is as follow:
wellCountNPV =
1.0e+04 *
0.0230 1.5314
0.0113 2.7044
0.0023 0.2649
0.0413 2.4199
0.0220 1.4241
0.0051 0.1754
0.0074 0.4027
0.0071 1.1382
0.0145 0.1349
0.0213 0.8991
But when I add syntax 'set(handles.uitable,'Data',wellCounNPV)' to display on GUI, it occur error as follow:
Reference to a cleared variable handles.
Error in untitled>pushbutton1_Callback (line 138)
set(handles.uitable1,'Data',wellCounNPV);
  3 件のコメント
Tien Tran
Tien Tran 2016 年 5 月 7 日
How to call that? Can you write a code more detail for me to refer?
Tien Tran
Tien Tran 2016 年 5 月 7 日
I have fixed that. It run now. Thanks Image!

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

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by