matlab中hobject什么意思,完全小白求大神解释代码
该楼层疑似违规已被系统折叠隐藏此楼查看此楼function varargout = B2(varargin)% B2 M-file for B2.fig%B2, by itself, creates a new B2 or raises the existing%singleton*.%%H = B2 returns the handle to a new B...
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
function varargout = B2(varargin)
% B2 M-file for B2.fig
% B2, by itself, creates a new B2 or raises the existing
% singleton*.
%
% H = B2 returns the handle to a new B2 or the handle to
% the existing singleton*.
%
% B2('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in B2.M with the given input arguments.
%
% B2('Property','Value',...) creates a new B2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before B2_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to B2_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help B2
% Last Modified by GUIDE v2.5 08-Oct-2009 11:19:06
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @B2_OpeningFcn, ...
'gui_OutputFcn', @B2_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before B2 is made visible.
function B2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to B2 (see VARARGIN)
% Choose default command line output for B2
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes B2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = B2_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu2
global b;
b=get(hObject,'Value');
% --- Executes during object creation, after setting all properties.
function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
global a;
a=get(hObject,'Value');
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton1.
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)
global a;
global b;
c1=solve('116/T=1.5*log(T)-2.3');
c2=solve('116/T=1.5*log(T)-9.2');
c3=solve('116/T=1.5*log(T)');
c4=solve('116/T=1.5*log(T)-6.9');
c5=solve('116/T=1.5*log(T)+3');
c6=solve('116/T=1.5*log(T)-3.9');
switch a
case 1
if b==1
set(handles.text1,'String',double(c1));
elseif b==2;
set(handles.text1,'String',double(c3));
elseif b==3;
set(handles.text1,'String',double(c5));
end;
case 2
if b==1
set(handles.text1,'String',double(c2));
elseif b==2;
set(handles.text1,'String',double(c4));
elseif b==3;
set(handles.text1,'String',double(c6));
end;
end
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global a b;
c3=solve('116/T=1.5*log(T)');
c4=solve('116/T=1.5*log(T)-6.9');
if a==1
T=17.58:0.1:40;
D=1-exp(116./T)*10^(14)/10^(15)./T.^(1.5);
plot(T,D);
xlabel('开氏温度K');
ylabel('电离度');
title('浓度为10^ 14(cm*3)时电离度和温度的关系图线');
set(handles.text3,'String',double(c3));
else a==2
T=80:1:550;
D=1-exp(116./T)*10^(17)/10^(15)./T.^(1.5);
plot(T,D);
xlabel('开氏温度K');
ylabel('电离度');
title('浓度为10^ 17(cm*3)时电离度和温度的关系图线');
set(handles.text3,'String',double(c4));
end
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(gcf)
% --- Executes during object creation, after setting all properties.
function text1_CreateFcn(hObject, eventdata, handles)
% hObject handle to text1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)