Using slider in GUIDE to perform 2 tasks

1 回表示 (過去 30 日間)
Cheng Yoong
Cheng Yoong 2011 年 3 月 2 日
I have the following GUI: http://postimage.org/image/n0ekwaw4/ I'm trying to use the slider to perform 2 tasks: 1. display current slider number to blue textbox 2. display current slider number+1 to red textbox
Task 1 i can do it but task 2 i have no idea,anyone can give me solution? ps:new guy here,please forgive me if there are any mistake.

採用された回答

Matt Fig
Matt Fig 2011 年 3 月 2 日
For task 2, do exactly the same thing you did with task 1, except add 1. You might be having trouble with adding 1 because you have strings. Lets say that you get the position of the slider and store it in variable P. Then do:
STR = num2str(str2double(P)+1);
and set the editbox 'string' property to STR.
  6 件のコメント
Cheng Yoong
Cheng Yoong 2011 年 3 月 3 日
Mind to ask Sir, how do we actually store the value of slider?
Matt Fig
Matt Fig 2011 年 3 月 3 日
You can store the value of the slider in GUIDATA if you wish. Though I don't know why you would want to store it. Anywhere you wish to access the stored value, you could also access the value itself by just calling:
get(sliderhandle,'value')

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

その他の回答 (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