Value from popup for a another calculation

1 次查看(过去 30 天)
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);

采纳的回答

Walter Roberson
Walter Roberson 2017-11-2
  2 个评论
Aj
Aj 2017-11-2
can u do it with my example? i dont get it -.-
Walter Roberson
Walter Roberson 2017-12-27
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);

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 String Parsing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by