Help with GUI push buttons and multiple axes

1 回表示 (過去 30 日間)
Evan Khan
Evan Khan 2015 年 1 月 17 日
回答済み: Shaun 2015 年 1 月 17 日
I am trying to create a GUI in matlab where I can display a default image on five axes, and then with a button press, change each of the individual axes to display an image specified by a function on button press. So far, I have been able to display the default image, but I have no idea how to do what I need after button press.

回答 (1 件)

Shaun
Shaun 2015 年 1 月 17 日
Read up on callbacks Matlab Help
Concept:
X = peaks(200);
for i = 1:5
subplot(1,5,i)
ih = imagesc(X);
uh = uicontrol('Callback',@(~,~) set(ih,'CData',rand(200)),...
'String',sprintf('Axes%d',i));
if i==1
pos = get(uh,'Position');
else
pos(1) = pos(1)+70;
set(uh,'Position',pos)
end
end

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by