Value from popup for a another calculation

조회 수: 1 (최근 30일)
Aj
Aj 2017년 11월 2일
댓글: 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;
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개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by