Add a uicontrol push button in uitable to refresh data

Hi,
I am trying to add a push button in the uitable so that I could refresh data in there.
I am not sure whether I should use refreshdata, but I am thinking about things like this (just a dummy code)
f = figure('Position',[250 100 600 550]);
t = uitable('Parent',f,'Data',dat,...
'Position',[20 180 306 150]);
b = uicontrol('Style', 'pushbutton', 'String', 'Recalc',...
'Position', [20 20 50 20],...
'Callback', '@refreshdata');
Thanks in advance!!

回答 (1 件)

Sean de Wolski
Sean de Wolski 2012 年 8 月 15 日

0 投票

Since a uitable does not have an 'XDataSource' etc. it will not update with refreshdata. You will need to write your own update function that updates the uitable based on whatever it is you are updating. If you can give us more info we can be able to help you through it.

3 件のコメント

Zoe Zhang
Zoe Zhang 2012 年 8 月 15 日
Thanks! Sounds complicated...
What kind of infor? The compiler I created firstly take a gui input, use the input to search and load a specific file. Use data in that file to value a financial instrument and output the results using uitable.
Sean de Wolski
Sean de Wolski 2012 年 8 月 15 日
Okay. And you said you want MATLAB to do something refreshing when that button is pushed. What do you want something do you want to be refreshed?
Alex Stoja
Alex Stoja 2016 年 11 月 18 日
Hi I got a similar problem. I got my acceleration live plotting in a figure. After 10sec the plot ist over an with a pushbutton I want to run the program again without closing the figure. My code looks like this
if true
btn = uicontrol('Style', 'pushbutton', 'String', 'Clear',...
'Position', [20 20 50 20],...
'Callback', 'cla');
btn1 = uicontrol('Style', 'pushbutton', 'String', 'Start',...
'Position', [20 0 50 20],...
'Callback','newplot' );
% code
end
Could you help me Im pretty new, working with matlab
Greets Alex

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

カテゴリ

ヘルプ センター および File ExchangeMigrate GUIDE Apps についてさらに検索

質問済み:

2012 年 8 月 15 日

コメント済み:

2016 年 11 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by