matlab不同函数间互相取变数值function radiobutton1_Callback(hObject,eventdata,handles)set(handles.radiobutton1,'value',1);set(handles.radiobutton2,'value',0);set(handles.radiobutton3,'value',0);if (get(hObject,'Value') == 1)sample=1;Etiqbut
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/22 13:52:56
matlab不同函数间互相取变数值function radiobutton1_Callback(hObject,eventdata,handles)set(handles.radiobutton1,'value',1);set(handles.radiobutton2,'value',0);set(handles.radiobutton3,'value',0);if (get(hObject,'Value') == 1)sample=1;Etiqbut
matlab不同函数间互相取变数值
function radiobutton1_Callback(hObject,eventdata,handles)
set(handles.radiobutton1,'value',1);
set(handles.radiobutton2,'value',0);
set(handles.radiobutton3,'value',0);
if (get(hObject,'Value') == 1)
sample=1;
Etiqbutton2
RadioButton
end
.
.
.
.
function pushbutton1_Callback(hObject,eventdata,handles)
%load('matlab')
character=1;
RadioButton
DATA
ButtonData
atoz
就以上面两个函数而言,请问我该怎麼在function pushbutton1_Callback取得function radiobutton1_Callback里面sample的数值.
我有特地在写一个save.m的程式,让radiobutton1的sample值放进去save.m程式里面,但当我在重pushbutton1去呼叫save.m去取得sample的值时,sample已经被清空,没有任何资料.
请问我该怎麼去取得呢?
matlab不同函数间互相取变数值function radiobutton1_Callback(hObject,eventdata,handles)set(handles.radiobutton1,'value',1);set(handles.radiobutton2,'value',0);set(handles.radiobutton3,'value',0);if (get(hObject,'Value') == 1)sample=1;Etiqbut
%radiobutton1_Callback
handles.sample=1;
guidata(hObject,handles);
%pushbutton1_Callback
sample=handles.sample;
说明:请参考guidata的用法,保存变量到guidata中,然后在不同的对象中调用.