How do I use the function "uicontrol" ?

3 ビュー (過去 30 日間)
Keisuke Kazama
Keisuke Kazama 2015 年 3 月 5 日
コメント済み: Keisuke Kazama 2015 年 3 月 6 日
Hello. I described the following code.
function viewer
load view_data.mat;
fig1 = figure(1);
clf;
hax1 = axes('Units','pixels');
plot3(x_layer1(jjj,:),y_layer1(jjj,:),z_layer1(jjj,:),'.k');
grid on;
hold on;
end
I want to change the "jjj" by using slider in "uicontrol". How do I describe the function of uicontrol?

採用された回答

Giorgos Papakonstantinou
Giorgos Papakonstantinou 2015 年 3 月 5 日
The minimum example I can give you is:
sld = uicontrol('Style', 'slider',...
'Min',1,'Max',50,'Value',41,...
'Position', [5 5 120 20],...
'Callback', @(obj, evt) viewer(obj, evt));
Of course you have to change you function viewer.
function viewer(obj, evt)
.....
Additionally, I would suggest to load view_data.mat outside the Callback function and provide (an) additional argument(s) to the CallBack with your x_layer1, y_layer1 , z_layer1 variables.
Finally, remove the clf command from function viewer because it will clear you current figure window and eventually erase the slider.
  1 件のコメント
Keisuke Kazama
Keisuke Kazama 2015 年 3 月 6 日
Thank you for your kind explanation. I realized the objective.

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

その他の回答 (0 件)

カテゴリ

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