sharing data between GUİ functions?
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Desktop in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!