How to Update Data automatically in a UITABLE GUI?
7 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am not very used to the GUI framework of MATLAB. I have a GUI, a uitable which is linked to a table situated in my workstation in which the data are constantly changing. So I want to know how I can make the data which are shown in the GUI table, dynamic with a timer say a refresh each 10 seconds.
From what I can see, you need to initiate a timer then a callback?
I would really appreciate any help.
Thank you
D.
0 件のコメント
回答 (1 件)
Walter Roberson
2015 年 8 月 11 日
Yes, a timer with a callback that fetched the latest information and set() the Data property of the uitable should work.
3 件のコメント
Walter Roberson
2015 年 8 月 12 日
OpenFcn is as good a place as any when you are using GUIDE. The Callback would be a property you set for the timer object. It would have nothing to do with CellEditCallback. It should call a function that grabs the data from the table on your workspace (I am presuming that is a database access or perhaps an ActiveX call to Excel).
guifig = ancestor(hObject, 'figure');
timerobj = timer(.....);
set(timerobj, 'Callback', @(src,evt) Update_From_Table(src, evt, guifig));
...
function Update_From_Table(hObject, event, guifig)
handles = guidata(guifig);
do something to get the update from the workspace table into newdata
set(handles.uitable1, 'Data', newdata);
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!