Value from popup for a another calculation

1 view (last 30 days)
function popupmenu3_Callback(hObject, eventdata, handles)
contents = cellstr(get(hObject,'String'));
Werkstoff= contents{get(hObject,'Value')};
if(strcmp(Werkstoff,'C25'))
Rm_N= 550; %MPa
Rp_N=600;
elseif(strcmp(Werkstoff,'C40'))
Rm_N=600;
Rp_N=800;
elseif(strcmp(Werkstoff,'C45'))
Rm_N=100;
Rp_N=5500;
end
I Choose one option from the popup and then i get values for Rm_N and Rp_N. What i need to do, when I want to use the Rm_N and Rp_N from my chosen option for my calculation in the bottom?
function pushbutton1_Callback(hObject, eventdata, handles)
% Zug-Druck
S_max_zd= *Rp_N*;
F_Max_zo= *Rm_N*/2;
set(handles.text39, 'string', S_max_zd);
set(handles.text40, 'string', F_max_zo);

Accepted Answer

Walter Roberson
Walter Roberson on 2 Nov 2017
  2 Comments
Aj
Aj on 2 Nov 2017
can u do it with my example? i dont get it -.-
Walter Roberson
Walter Roberson on 27 Dec 2017
function popupmenu3_Callback(hObject, eventdata, handles)
contents = cellstr(get(hObject,'String'));
Werkstoff= contents{get(hObject,'Value')};
if(strcmp(Werkstoff,'C25'))
Rm_N= 550; %MPa
Rp_N=600;
elseif(strcmp(Werkstoff,'C40'))
Rm_N=600;
Rp_N=800;
elseif(strcmp(Werkstoff,'C45'))
Rm_N=100;
Rp_N=5500;
else
Rm_N = inf;
Rp_N = inf;
end
handles.Rm_N = Rm_N;
handles.Rp_N = Rp_N;
guidata(hObject, handles);
function pushbutton1_Callback(hObject, eventdata, handles)
% Zug-Druck
S_max_zd= handles.Rp_N;
F_Max_zo= handles.Rm_N/2;
set(handles.text39, 'string', S_max_zd);
set(handles.text40, 'string', F_max_zo);

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!