📄 samplexpo.m
字号:
function varargout = samplexpo(varargin)% SAMPLEXPO.m-file for samplexpo.fig% SAMPLEXPO, by itself, creates a new SAMPLEXPO or raises the existing% singleton*.%% H = SAMPLEXPO returns the handle to a new SAMPLEXPO or the handle to% the existing singleton*.%% SAMPLEXPO('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in SAMPLEXPO.M with the given input arguments.%% SAMPLEXPO('Property','Value',...) creates a new SAMPLEXPO or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before samplexpo_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to samplexpo_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 16-Mar-2004 14:33:04% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @samplexpo_OpeningFcn, ... 'gui_OutputFcn', @samplexpo_OutputFcn, ... 'gui_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 samplexpo_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 = samplexpo_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 samplexpo_fig.function samplexpo_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';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -