⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qt.m

📁 结合Matlab的GUI和神经网络开发出来的界面
💻 M
字号:
function varargout = QT(varargin)% QT M-file for QT.fig%      QT, by itself, creates a new QT or raises the existing%      singleton*.%%      H = QT returns the handle to a new QT or the handle to%      the existing singleton*.%%      QT('CALLBACK',hObject,eventData,handles,...) calls the local%      function named CALLBACK in QT.M with the given input arguments.%%      QT('Property','Value',...) creates a new QT or raises the%      existing singleton*.  Starting from the left, property value pairs are%      applied to the GUI before QT_OpeningFcn gets called.  An%      unrecognized property name or invalid value makes property application%      stop.  All inputs are passed to QT_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 QT% Last Modified by GUIDE v2.5 05-Mar-2009 18:04:01% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @QT_OpeningFcn, ...                   'gui_OutputFcn',  @QT_OutputFcn, ...                   'gui_LayoutFcn',  [] , ...                   'gui_Callback',   []);if nargin && ischar(varargin{1})    gui_State.gui_Callback = str2func(varargin{1});endif 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 QT is made visible.function QT_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 QT (see VARARGIN)% Choose default command line output for QThandles.output = hObject;movegui(gcf,'center');  % 设置窗口居中global x y net tr xy=varargin{1};         % 读取主界面传递的数据x=xy{1};y=xy{2};net=xy{3};tr=xy{4};% Update handles structureguidata(hObject, handles);% UIWAIT makes QT wait for user response (see UIRESUME)% uiwait(handles.figure4);% --- Outputs from this function are returned to the command line.function varargout = QT_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 structurevarargout{1} = handles.output;% --- 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 x yx1=x(:,1);x2=x(:,2);x3=x(:,3);y1=y(:,1);y2=y(:,2);ti=0:0.01:1;[XI,YI]=meshgrid(ti,ti);    % 产生“格点”矩阵popup_sel=get(handles.popupmenu1,'Value');switch popup_sel    case 1        msgbox('请选择三维绘图的数据!','错误');    case 2        z=griddata(x2,x3,x1,XI,YI);    % 规则化数据及表面拟合        mesh(XI,YI,z),hold;            % 绘制三维网格图        plot3(x2,x3,x1,'*'),hold off;  % 显示原始数据点    case 3        z=griddata(y1,y2,x1,XI,YI);        mesh(XI,YI,z),hold;        plot3(y1,y2,x1,'*'),hold off;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 x yx1=x(:,1);x2=x(:,2);x3=x(:,3);y1=y(:,1);y2=y(:,2);ti=0:0.01:1;[XI,YI]=meshgrid(ti,ti);    % 产生“格点”矩阵popup_sel=get(handles.popupmenu1,'Value');switch popup_sel    case 2        z=griddata(x2,x3,x1,XI,YI);    % 规则化数据及表面拟合        surf(XI,YI,z),hold;            % 绘制三维着色表面图        plot3(y1,y2,x1,'*'),hold off;  % 显示原始数据点    case 3        z=griddata(y1,y2,x1,XI,YI);        surf(XI,YI,z),hold;        plot3(y1,y2,x1,'*'),hold off;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)global x yx1=x(:,1);x2=x(:,2);x3=x(:,3);y1=y(:,1);y2=y(:,2);ti=0:0.01:1;[XI,YI]=meshgrid(ti,ti);    % 产生“格点”矩阵popup_sel=get(handles.popupmenu1,'Value');switch popup_sel    case 2        z=griddata(x2,x3,x1,XI,YI);   % 规则化数据及表面拟合    case 3        z=griddata(y1,y2,x1,XI,YI);   % 规则化数据及表面拟合endsurf(XI,YI,z);    % 绘制三维着色表面图shading interp;hold on;[c ch]=contour3(z,20);set(ch,'edgecolor','b');[u v]=gradient(z);h=streamslice(-u,-v);set(h,'color','k');for i=1:length(h);    zi=interp2(z,get(h(i),'xdata'),get(h(i),'ydata'));    set(h(i),'zdata',zi);endaxis tight;% --- Executes during object creation, after setting all properties.function axes1_CreateFcn(hObject, eventdata, handles)% hObject    handle to axes1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: place code in OpeningFcn to populate axes1% --- 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 popupmenu1popup_sel=get(handles.popupmenu1,'Value');if popup_sel==1    msgbox('请选择三维绘图的数据!','错误');  % 提示用户选择三维绘图的数据end;% --- 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 pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton4 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global trplotperf(tr);  % 绘制神经网络性能

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -