📄 samplexpogui.m
字号:
function varargout = samplexpogui(varargin)% SAMPLEXPOGUI.m-file for samplexpogui.fig% SAMPLEXPOGUI, by itself, creates a new SAMPLEXPOGUI or raises the existing% singleton*.%% H = SAMPLEXPOGUI returns the handle to a new SAMPLEXPOGUI or the handle to% the existing singleton*.%% SAMPLEXPOGUI('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in SAMPLEXPOGUI.M with the given input arguments.%% SAMPLEXPOGUI('Property','Value',...) creates a new SAMPLEXPOGUI or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before samplexpogui_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to samplexpogui_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% Last Modified by GUIDE v2.5 31-Mar-2004 13:24:40% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @samplexpogui_OpeningFcn, ... 'gui_OutputFcn', @samplexpogui_OutputFcn, ... 'gui_LayoutFcn', @samplexpogui_LayoutFcn, ... 'gui_Callback', []);if nargin & isstr(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 sinesumgui2 is made visible.function samplexpogui_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject; guidata(hObject, handles); set(gcf,'UserData',handles); samplexpofn;% --- Outputs from this function are returned to the command line.function varargout = samplexpogui_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;function freq1_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); endfunction amp1_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); endfunction phase1_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% Executes on textbox entryfunction freq1_Callback(hObject, eventdata, handles) freq1 = str2num(get(hObject,'String')); if freq1 < 20 freq1 = 20; elseif freq1 > 1000 freq1 = 1000; end set(handles.freq1,'String',num2str(freq1)); set(handles.freq1slider,'Value',freq1); samplexpofn 'update';function amp1_Callback(hObject, eventdata, handles) amp1 = str2num(get(hObject,'String')); if amp1 < 0 amp1 = 0; elseif amp1 > 1 amp1 = 1; end set(handles.amp1,'String',num2str(amp1)); set(handles.amp1slider,'Value',amp1); samplexpofn 'update';function phase1_Callback(hObject, eventdata, handles) phase1 = str2num(get(hObject,'String')); if phase1 < -180 while phase1 < -180 phase1 = phase1 + 360; end elseif phase1 > 180 while phase1 > 180 phase1 = phase1 - 360; end end set(handles.phase1,'String',num2str(phase1)); set(handles.phase1slider,'Value',phase1); samplexpofn 'update';% --- Executes during object creation, after setting all properties.function freq1slider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function freq1slider_Callback(hObject, eventdata, handles) freq1 = num2str(get(hObject,'Value')); set(handles.freq1,'String',freq1); samplexpofn 'update';% --- Executes during object creation, after setting all properties.function amp1slider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function amp1slider_Callback(hObject, eventdata, handles) amp1 = num2str(get(hObject,'Value')); set(handles.amp1,'String',amp1); samplexpofn 'update';% --- Executes during object creation, after setting all properties.function phase1slider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function phase1slider_Callback(hObject, eventdata, handles) phase1 = num2str(get(hObject,'Value')); set(handles.phase1,'String',phase1); samplexpofn 'update';% --- Executes during object creation, after setting all properties.function offset_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction offset_Callback(hObject, eventdata, handles) offset = str2num(get(hObject,'String')); if offset < 0 offset = 0; elseif offset > 1 offset = 1; end set(handles.offset,'String',num2str(offset)); set(handles.offsetslider,'Value',offset); samplexpofn 'update';% --- Executes during object creation, after setting all properties.function offsetslider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function offsetslider_Callback(hObject, eventdata, handles) offset = num2str(get(hObject,'Value')); set(handles.offset,'String',offset); samplexpofn 'update';% --- Executes during object creation, after setting all properties.function Fs_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction Fs_Callback(hObject, eventdata, handles) Fs = str2num(get(hObject,'String')); if (Fs > 1000) Fs = 1000; end if (Fs < 0) Fs = 0; end set(handles.Fsslider,'Value',log2(Fs)); samplexpofn 'update';% --- Executes during object creation, after setting all properties.function Fsslider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function Fsslider_Callback(hObject, eventdata, handles) Fs = num2str(floor(2^get(hObject,'Value'))); if (Fs > 1000) Fs = 1000; end if (Fs < 0) Fs = 0; end set(handles.Fs,'String',Fs); samplexpofn 'update';% --- Executes during object creation, after setting all properties.function periods_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction periods_Callback(hObject, eventdata, handles) periods = str2num(get(hObject,'String')); if periods < 1 periods = 1; elseif periods > 10 periods = 10; end set(handles.periods,'String',num2str(periods)); set(handles.periodslider,'Value',periods); samplexpofn 'update';% --- Executes during object creation, after setting all properties.function periodslider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function periodslider_Callback(hObject, eventdata, handles) periods = num2str(get(hObject,'Value')); set(handles.periods,'String',periods); samplexpofn 'update';% --- Executes on button press in gridbox.function gridbox_Callback(hObject, eventdata, handles) samplexpofn 'update';% --- Executes on button press in interpbox.function interpbox_Callback(hObject, eventdata, handles) samplexpofn 'update';% --- Executes on button press in samplebox.function samplebox_Callback(hObject, eventdata, handles) samplexpofn 'update';% --- Executes when user attempts to close samplexpogui_fig.function samplexpogui_fig_CloseRequestFcn(hObject, eventdata, handles)delete(hObject);% --- Executes during object creation, after setting all properties.function nbits_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction nbits_Callback(hObject, eventdata, handles) nbits = floor(str2num(get(hObject,'String'))); if nbits < 1 nbits = 1; elseif nbits > 16 nbits = 16; end set(handles.nbits,'String',num2str(nbits)); set(handles.nbitsslider,'Value',nbits); samplexpofn 'update';% --- Executes during object creation, after setting all properties.function nbitsslider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function nbitsslider_Callback(hObject, eventdata, handles) nbits = num2str(floor(get(hObject,'Value'))); set(handles.nbits,'String',nbits); samplexpofn 'update';% --- Executes during object creation, after setting all properties.function wave_CreateFcn(hObject, eventdata, handles)% hObject handle to wave (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 wave.function wave_Callback(hObject, eventdata, handles) samplexpofn 'update';% --------------------------------------------------------------------function help_Callback(hObject, eventdata, handles)% hObject handle to help (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) samplexpofn 'help';% --- Creates and returns a handle to the GUI figure. function h1 = samplexpogui_LayoutFcn(policy)% policy - create a new figure or use a singleton. 'new' or 'reuse'.persistent hsingleton;if strcmpi(policy, 'reuse') & ishandle(hsingleton) h1 = hsingleton; return;endh1 = figure(...'Units','characters',...'Color',[0.701960784313725 0.701960784313725 0.701960784313725],...'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],...'IntegerHandle','off',...'InvertHardcopy',get(0,'defaultfigureInvertHardcopy'),...'KeyPressFcn','update_Callback(hObject, eventdata, handles)',...'MenuBar','none',...'Name','samplexpo',...'NumberTitle','off',...'PaperPosition',get(0,'defaultfigurePaperPosition'),...'Position',[128.6 0.307692307692299 115.2 54],...'Renderer',get(0,'defaultfigureRenderer'),...'RendererMode','manual',...'Resize','off',...'HandleVisibility','callback',...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -