matlab gui 实现对输入数据的计算,输入包括4个edit text和1个popupmenu
计算按钮的代码functionpushbutton1_Callback(hObject,eventdata,handles)%hObjecthandletopushbut...
计算按钮的代码
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%计算按钮回调函数
%参数定义
rou=610;g=9.8;
pg=str2double(get(handles.edit2,'String'));
p0=str2double(get(handles.edit3,'String'));
h0=str2double(get(handles.edit7,'String'));
A=str2double(get(handles.edit8,'String'));
C0=str2double(get(handles.popupmenu2_Value,'String'));
%计算公式
Q=rou*C0*A*(2*((pg-p0)/rou+g*h0))^(1/2);
QQQ = num2str(Q);
set(handles.edit9,'String','泄漏速率为:',QQQ,'kg/s');
guidata(hObject,handles);
纯小白 求大神指点哪里有错误!!!感激不尽 展开
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%计算按钮回调函数
%参数定义
rou=610;g=9.8;
pg=str2double(get(handles.edit2,'String'));
p0=str2double(get(handles.edit3,'String'));
h0=str2double(get(handles.edit7,'String'));
A=str2double(get(handles.edit8,'String'));
C0=str2double(get(handles.popupmenu2_Value,'String'));
%计算公式
Q=rou*C0*A*(2*((pg-p0)/rou+g*h0))^(1/2);
QQQ = num2str(Q);
set(handles.edit9,'String','泄漏速率为:',QQQ,'kg/s');
guidata(hObject,handles);
纯小白 求大神指点哪里有错误!!!感激不尽 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询