Borrar filtros
Borrar filtros

Value from popup for a another calculation

1 visualización (últimos 30 días)
Aj
Aj el 2 de Nov. de 2017
Comentada: Walter Roberson el 27 de Dic. de 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;
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);

Respuesta aceptada

Walter Roberson
Walter Roberson el 2 de Nov. de 2017
  2 comentarios
Aj
Aj el 2 de Nov. de 2017
can u do it with my example? i dont get it -.-
Walter Roberson
Walter Roberson el 27 de Dic. de 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);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre String Parsing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by