How can I use slider value in push button area, to generate a function.
4 ビュー (過去 30 日間)
古いコメントを表示
function t_1_Callback(hObject, eventdata, handles)
a=get(handles.t_1,'value');
set(handles.slider_editText,'string',num2str(a));
guidata(hObject,handles);
a=str2num(a);
.
.
.
.
function on_switch_Callback(hObject, eventdata, handles)
H01=[cosd(a), 0, sind(a), 30*cosd(a); sind(a), 0, -cosd(a), 30*sind(a); 0, 1, 1,30; 0,0,0,1];
3 件のコメント
Adam
2019 年 3 月 11 日
Either do as Geoff Hayes shows or you need to save
handles.a = ...
guidata( hObject, handles )
in your slider callback and then
a = handles.a
in your pushbutton callback, but on the whole there really isn't much point constantly updating a variable on handles when you can just get it direct from the slider when you need it.
回答 (1 件)
Geoff Hayes
2019 年 3 月 7 日
Tonusree - if you want to use the a value in your pushbutton callback (is this on_switch_Callback?) then just do
function on_switch_Callback(hObject, eventdata, handles)
a=get(handles.t_1,'value');
H01=[cosd(a), 0, sind(a), 30*cosd(a); sind(a), 0, -cosd(a), 30*sind(a); 0, 1, 1,30; 0,0,0,1];
% etc.
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Assembly についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!