Replace buttons
古いコメントを表示
Hello,
I have a function which creates buttons in my gui when I load data. The number of buttons depend on the size of the XTickLabels and YTickLabels. If I load some other data I want that the buttons from the first data disappear and are replaced by the new amount of buttons. Don't now how I can remove the buttons and how the function knows if there are buttons or not. Here is the code of the button-creation:
s = size(x,2);
breiteQuadrat = 625/s
for n=1:s
handles.b{n}=uicontrol('Style','PushButton','Units','pixels', 'Position',[125-breiteQuadrat/2-5+breiteQuadrat*n 40 10 10],'Visible','on','Callback',@(obj,event)msgbox(num2str(n),num2str(n)));
end
t = size(y,2);
hoeheQuadrat = 625/t
for n=1:t
handles.c{n}=uicontrol('Style','PushButton','Units','pixels', 'Position',[40 125-hoeheQuadrat/2-5+hoeheQuadrat*n 10 10],'Visible','on','Callback',@(obj,event)msgbox(num2str(n),num2str(n)));
end
採用された回答
その他の回答 (1 件)
Teresa
2011 年 7 月 29 日
0 投票
4 件のコメント
Paulo Silva
2011 年 7 月 29 日
Please use the comments, don't create new answers just to comment.
isfield(handles,'b') %check for the existence of b
all(cellfun(@ishandle,handles.b)) %check if all values in b are handles
Teresa
2011 年 8 月 1 日
Teresa
2011 年 8 月 1 日
Teresa
2011 年 8 月 1 日
カテゴリ
ヘルプ センター および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!