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

📄 testgui3.m

📁 用matlab的GUI做的一个数字信号处理系统
💻 M
字号:
function varargout = testGUI3(varargin)
% TESTGUI3 M-file for testGUI3.fig
%      TESTGUI3, by itself, creates a new TESTGUI3 or raises the existing
%      singleton*.
%
%      H = TESTGUI3 returns the handle to a new TESTGUI3 or the handle to
%      the existing singleton*.
%
%      TESTGUI3('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in TESTGUI3.M with the given input arguments.
%
%      TESTGUI3('Property','Value',...) creates a new TESTGUI3 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before testGUI3_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to testGUI3_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 testGUI3

% Last Modified by GUIDE v2.5 15-Jun-2007 22:31:24
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @testGUI3_OpeningFcn, ...
                   'gui_OutputFcn',  @testGUI3_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & isstr(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 testGUI3 is made visible.
function testGUI3_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 testGUI3 (see VARARGIN)

% Choose default command line output for testGUI3
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes testGUI3 wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = testGUI3_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;


% Call the popup menu callback to initialize the handles.data
% field with the current value of the popup
data_popup_Callback(handles.data_popup,[],handles)
% --------------------------------------------------------------------function file_menu_Callback(hObject, eventdata, handles)% hObject    handle to file_menu (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)if isempty(get(handles.axes1,'Children'))
set(handles.print_submenu,'Enable','off')
else
set(handles.print_submenu,'Enable','on')
end% --------------------------------------------------------------------function print_submenu_Callback(hObject, eventdata, handles)% hObject    handle to print_submenu (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)%print -f handles.figure1
printpreview;% --------------------------------------------------------------------function close_submenu_Callback(hObject, eventdata, handles)% hObject    handle to close_submenu (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)delete(handles.figure1)% --- Executes on button press in mesh_pushbutton.function mesh_pushbutton_Callback(hObject, eventdata, handles)% hObject    handle to mesh_pushbutton (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)z = handles.data; % Load data from handles structure
mesh(z)% --- Executes on button press in contour_pushbutton.function contour_pushbutton_Callback(hObject, eventdata, handles)% hObject    handle to contour_pushbutton (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)z = handles.data; % Load data from handles structure
contour(z)% --- Executes on button press in surf_pushbutton.function surf_pushbutton_Callback(hObject, eventdata, handles)% hObject    handle to surf_pushbutton (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)

z = handles.data; % Load data from handles structure
surf(z);% --- Executes during object creation, after setting all properties.function data_popup_CreateFcn(hObject, eventdata, handles)% hObject    handle to data_popup (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end

% --- Executes on selection change in data_popup.function data_popup_Callback(hObject, eventdata, handles)% hObject    handle to data_popup (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 data_popup contents as cell array%        contents{get(hObject,'Value')} returns selected item from data_popupval = get(hObject,'Value');
switch val
case 1 % User selected peaks
handles.data = peaks(35);
case 2 % User selected membrane
handles.data = membrane;
case 3 % User selected sinc
[x,y] = meshgrid(-8:.5:8);
r = sqrt(x.^2+y.^2) + eps;
z = sin(r)./r;
handles.data = z;
end
guidata(hObject,handles) % Save the handles structure after adding data

⌨️ 快捷键说明

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