📄 gui_sigout.m
字号:
function varargout = gui_sigout(varargin)% GUI_SIGOUT M-file for gui_sigout.fig% GUI_SIGOUT, by itself, creates a new GUI_SIGOUT or raises the existing% singleton*.%% H = GUI_SIGOUT returns the handle to a new GUI_SIGOUT or the handle to% the existing singleton*.%% GUI_SIGOUT('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in GUI_SIGOUT.M with the given input arguments.%% GUI_SIGOUT('Property','Value',...) creates a new GUI_SIGOUT or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before gui_sigout_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to gui_sigout_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 gui_sigout% Last Modified by GUIDE v2.5 09-Jul-2008 19:36:57% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @gui_sigout_OpeningFcn, ... 'gui_OutputFcn', @gui_sigout_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 gui_sigout is made visible.function gui_sigout_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 gui_sigout (see VARARGIN)% Choose default command line output for gui_sigouthandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes gui_sigout wait for user response (see UIRESUME)uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = gui_sigout_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 structureglobal myxn;varargout{1} = myxn;% --- 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_index=get(handles.popupmenu1,'Value');switch popup_sel_index case 1 set(handles.text3,'String','信号表达式'); set(handles.text4,'String','时间起点'); set(handles.text5,'String','时间终点'); set(handles.text6,'String','采样频率'); set(handles.text4,'visible','on'); set(handles.text5,'visible','on'); set(handles.text6,'visible','on'); set(handles.edit2,'visible','on'); set(handles.edit3,'visible','on'); set(handles.edit4,'visible','on'); case 2 set(handles.text3,'String','信号长度'); set(handles.text4,'String','冲激位置'); set(handles.text4,'visible','on'); set(handles.text5,'visible','off'); set(handles.text6,'visible','off'); set(handles.edit2,'visible','on'); set(handles.edit3,'visible','off'); set(handles.edit4,'visible','off'); case 3 set(handles.text3,'String','信号长度'); set(handles.text4,'String','阶跃位置'); set(handles.text4,'visible','on'); set(handles.text5,'visible','off'); set(handles.text6,'visible','off'); set(handles.edit2,'visible','on'); set(handles.edit3,'visible','off'); set(handles.edit4,'visible','off'); case 4 set(handles.text3,'String','门左位置'); set(handles.text4,'String','门右位置'); set(handles.text5,'String','信号长度'); set(handles.text4,'visible','on'); set(handles.text5,'visible','on'); set(handles.text6,'visible','off'); set(handles.edit2,'visible','on'); set(handles.edit3,'visible','on'); set(handles.edit4,'visible','off'); case 5 set(handles.text3,'String','信号幅度'); set(handles.text4,'String','信号频率'); set(handles.text5,'String','时间长度'); set(handles.text6,'String','采样频率'); set(handles.text4,'visible','on'); set(handles.text5,'visible','on'); set(handles.text6,'visible','on'); set(handles.edit2,'visible','on'); set(handles.edit3,'visible','on'); set(handles.edit4,'visible','on'); case 6 set(handles.text3,'String','信号幅度'); set(handles.text4,'String','信号频率'); set(handles.text5,'String','时间长度'); set(handles.text6,'String','采样频率'); set(handles.text4,'visible','on'); set(handles.text5,'visible','on'); set(handles.text6,'visible','on'); set(handles.edit2,'visible','on'); set(handles.edit3,'visible','on'); set(handles.edit4,'visible','on'); case 7 set(handles.text3,'String','信号长度'); set(handles.text4,'visible','off'); set(handles.text5,'visible','off'); set(handles.text6,'visible','off'); set(handles.edit2,'visible','off'); set(handles.edit3,'visible','off'); set(handles.edit4,'visible','off'); case 8 set(handles.text3,'String','信号长度'); set(handles.text4,'visible','off'); set(handles.text5,'visible','off'); set(handles.text6,'visible','off'); set(handles.edit2,'visible','off'); set(handles.edit3,'visible','off'); set(handles.edit4,'visible','off');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');endfunction 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');endfunction edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (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 edit2 as text% str2double(get(hObject,'String')) returns contents of edit2 as a double% --- Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject handle to edit2 (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');endfunction edit3_Callback(hObject, eventdata, handles)% hObject handle to edit3 (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 edit3 as text% str2double(get(hObject,'String')) returns contents of edit3 as a double% --- Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject handle to edit3 (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');endfunction edit4_Callback(hObject, eventdata, handles)% hObject handle to edit4 (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 edit4 as text% str2double(get(hObject,'String')) returns contents of edit4 as a double% --- Executes during object creation, after setting all properties.function edit4_CreateFcn(hObject, eventdata, handles)% hObject handle to edit4 (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 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)axes(handles.axes1);cla;popup_sel_index=get(handles.popupmenu1,'Value');para1=get(handles.edit1,'String');para2=get(handles.edit2,'String');para3=get(handles.edit3,'String');para4=get(handles.edit4,'String');para1num=str2num(para1);para2=str2num(para2);para3=str2num(para3);para4=str2num(para4);switch popup_sel_index case 1 name='custom'; opera=para1; t1=para2; t2=para3; samp=para4; xn=sigout(name,opera,t1,t2,samp); name=para1; n=t1:1/samp:t2; case 2 name='deta'; N=para1num; n0=para2; xn=sigout(name,N,n0); n=0:N-1; case 3 name='jieyue'; N=para1num; n0=para2; xn=sigout(name,N,n0); n=0:N-1; case 4 name='gate'; n1=para1num; n2=para2; n3=para3; xn=sigout(name,n1,n2,n3); n=0:length(xn)-1; case 5 name='sin'; amp=para1num; freq=para2; time=para3; samp=para4; xn=sigout(name,amp,freq,time,samp); n=0:1/samp:time; case 6 name='square'; amp=para1num; freq=para2; time=para3; samp=para4; xn=sigout(name,amp,freq,time,samp); n=0:1/samp:time; case 7 name='rand'; len=para1num; xn=sigout(name,len); n=0:len-1; case 8 name='randn'; len=para1num; xn=sigout(name,len); n=0:len-1;endplot(n,xn);title(name);global myxn;myxn=xn;% --- 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)uiresume(handles.figure1);delete(handles.figure1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -