How to keep the value of certain variables as it is while switching PopUp menu option and updating other variable value?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello Everyone,
I have designed a Matlab Gui using guide, with a popupmenu, one update push button and two edit box. Let say, I want to update four variables a, b, c, d. For case 1 of the pop up menu, a and b will be updated with my two edit box value. For case 2, c and d will be u[dated with same edit tool box. I can do that. but, I also want to keep the previous values of a and b, while updating c and d also. But, i am failing to do so, since with case 1, matlab deals with only a and b, and with case 2, it deals with c and d.. But, After updating I want to keep all four variables,
My code for push button is given below:
function pushbutton1_Callback(hObject, eventdata, handles)
contents = get(handles.popupmenu1,'String');
popupmenu1value = contents{get(handles.popupmenu1,'Value')};
switch popupmenu1value
case 'ML'
a = str2num(get(handles.edit1, 'String'));
b = str2num(get(handles.edit2, 'String'));
a
b
case 'CL'
c = str2num(get(handles.edit1, 'String'));
d = str2num(get(handles.edit2, 'String'));
c
d
a
b
end
So, even during case two, I would like to have a and b with the values of case 1, when they were updated with push button earlier.
Thanks in Advance.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!