sharing data between GUİ functions?
이전 댓글 표시
hii,
i have been created a matlab gui application using checkbox and pushbutton i wanted to guide my push button to run two different .m file according to the Value of checkbox but however i am insistently getting an error: undefined function or variable "state" but when i define state for push button then it forgets totally about the "state" in checkbox how to handle it ? my guess is i havent put some code that will provide sharing data among them if i am right, then what will be that code ? Thank you for your help
my code;
function checkbox1_Callback(hObject, eventdata, handles)
% hObject handle to checkbox2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
state = get(hObject, 'Value');
if state1 == 0
display('unchecked');
else
display('checked');
end
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if uicontrol(state, 'Value', 1);
run(A.m);
else
run(B.m);
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Desktop에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!