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

📄 paramsetting.m

📁 FPGA输出数据的时频域分析GUI界面
💻 M
字号:
function varargout = ParamSetting(varargin)
% PARAMSETTING M-file for ParamSetting.fig
%      PARAMSETTING, by itself, creates a new PARAMSETTING or raises the existing
%      singleton*.
%
%      H = PARAMSETTING returns the handle to a new PARAMSETTING or the handle to
%      the existing singleton*.
%
%      PARAMSETTING('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in PARAMSETTING.M with the given input arguments.
%
%      PARAMSETTING('Property','Value',...) creates a new PARAMSETTING or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before ParamSetting_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to ParamSetting_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 ParamSetting

% Last Modified by GUIDE v2.5 15-Aug-2007 15:46:58

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @ParamSetting_OpeningFcn, ...
                   'gui_OutputFcn',  @ParamSetting_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(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 ParamSetting is made visible.
function ParamSetting_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 ParamSetting (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

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


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



function Fs_Callback(hObject, eventdata, handles)
% hObject    handle to Fs (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 Fs as text
%        str2double(get(hObject,'String')) returns contents of Fs as a double


% --- Executes during object creation, after setting all properties.
function Fs_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Fs (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



function RowStart_Callback(hObject, eventdata, handles)
% hObject    handle to RowStart (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 RowStart as text
%        str2double(get(hObject,'String')) returns contents of RowStart as a double


% --- Executes during object creation, after setting all properties.
function RowStart_CreateFcn(hObject, eventdata, handles)
% hObject    handle to RowStart (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



function RowEnd_Callback(hObject, eventdata, handles)
% hObject    handle to RowEnd (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 RowEnd as text
%        str2double(get(hObject,'String')) returns contents of RowEnd as a double


% --- Executes during object creation, after setting all properties.
function RowEnd_CreateFcn(hObject, eventdata, handles)
% hObject    handle to RowEnd (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



function ColumnStart_Callback(hObject, eventdata, handles)
% hObject    handle to ColumnStart (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 ColumnStart as text
%        str2double(get(hObject,'String')) returns contents of ColumnStart as a double


% --- Executes during object creation, after setting all properties.
function ColumnStart_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ColumnStart (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



function ColumnEnd_Callback(hObject, eventdata, handles)
% hObject    handle to ColumnEnd (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 ColumnEnd as text
%        str2double(get(hObject,'String')) returns contents of ColumnEnd as a double


% --- Executes during object creation, after setting all properties.
function ColumnEnd_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ColumnEnd (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 NoReversal.
function NoReversal_Callback(hObject, eventdata, handles)
% hObject    handle to NoReversal (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of NoReversal

val=get(handles.NoReversal,'Value');
if val==1
    set(handles.Reversal,'Value',0);
else
    set(handles.Reversal,'Value',1);
end


% --- Executes on button press in Reversal.
function Reversal_Callback(hObject, eventdata, handles)
% hObject    handle to Reversal (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of Reversal

val=get(handles.Reversal,'Value');
if val==1
    set(handles.NoReversal,'Value',0);
else
    set(handles.NoReversal,'Value',1);
end


% --- Executes on button press in WithSymbolBit.
function WithSymbolBit_Callback(hObject, eventdata, handles)
% hObject    handle to WithSymbolBit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of WithSymbolBit

val=get(handles.WithSymbolBit,'Value');
if val==1
    set(handles.WithoutSymbolBit,'Value',0);
else
    set(handles.WithoutSymbolBit,'Value',1);
end


% --- Executes on button press in WithoutSymbolBit.
function WithoutSymbolBit_Callback(hObject, eventdata, handles)
% hObject    handle to WithoutSymbolBit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of WithoutSymbolBit

val=get(handles.WithoutSymbolBit,'Value');
if val==1
    set(handles.WithSymbolBit,'Value',0);
else
    set(handles.WithSymbolBit,'Value',1);
end


% --- Executes on button press in OK.
function OK_Callback(hObject, eventdata, handles)
% hObject    handle to OK (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

ud.Fs=str2double(get(handles.Fs,'String'));
str1='->> The sample rate is: ';
str1=[str1,num2str(ud.Fs),' kHz'];

ud.RowStart=str2double(get(handles.RowStart,'String'));
str2='->> The starting row of the data matrix is: ';
str2=[str2,num2str(ud.RowStart)];

ud.RowEnd=str2double(get(handles.RowEnd,'String'));
str3='->> The ending row of the data matrix is: ';
str3=[str3,num2str(ud.RowEnd)];

ud.ColumnStart=str2double(get(handles.ColumnStart,'String'));
str4='->> The starting column of the data matrix is: ';
str4=[str4,num2str(ud.ColumnStart)];

ud.ColumnEnd=str2double(get(handles.ColumnEnd,'String'));
str5='->> The ending column of the data matrix is: ';
str5=[str5,num2str(ud.ColumnEnd)];

ud.valR = get(handles.NoReversal,'Value');
if ud.valR==1
    str6='->> The input data need not to be reversed.';
else
    str6='->> The input data has been reversed.';
end

ud.valS = get(handles.WithSymbolBit,'Value');
if ud.valS==1
    str7='->> The input data is with symbol bit.';
else
    str7='->> The input data is without symbol bit.';
end

str8 = '->> The parameters setting has been done.';

% Parameters illuminating
hfig=findobj(allchild(0),'Name','FFTPlatForm');
h=get(hfig);
ud_h=h.UserData;
str0=ud_h.str;
str=[str0;str1;str2;str3;str4;str5;str6;str7;str8];
set(ud_h.hdl.Notes,'String',str);

% Parameters transmitting
set(hfig,'UserData',ud);

% Set Bin2Float Push Button enable on
set(ud_h.hdl.Bin2Float,'Enable','on');

close


% --- Executes on button press in Default.
function Default_Callback(hObject, eventdata, handles)
% hObject    handle to Default (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% ud.str = 'The parameters setting has been concelled.';
% hfig=findobj(allchild(0),'Name','FFTPlatForm');
% set(hfig,'UserData',ud);

ud.Fs=91.2;
str1='->> The sample rate is: ';
str1=[str1,num2str(ud.Fs),' kHz'];

ud.RowStart=1;
str2='->> The starting row of the data matrix is: ';
str2=[str2,num2str(ud.RowStart)];

ud.RowEnd=8192;
str3='->> The ending row of the data matrix is: ';
str3=[str3,num2str(ud.RowEnd)];

ud.ColumnStart=4;
str4='->> The starting column of the data matrix is: ';
str4=[str4,num2str(ud.ColumnStart)];

ud.ColumnEnd=17;
str5='->> The ending column of the data matrix is: ';
str5=[str5,num2str(ud.ColumnEnd)];

str6='->> The input data need not to be reversed.';
str7='->> The input data is with symbol bit.';
str8 = '->> The parameters setting has been done.';

set(handles.Fs,'String',num2str(ud.Fs));
set(handles.RowStart,'String',num2str(ud.RowStart));
set(handles.RowEnd,'String',num2str(ud.RowEnd));
set(handles.ColumnStart,'String',num2str(ud.ColumnStart));
set(handles.ColumnEnd,'String',num2str(ud.ColumnEnd));

set(handles.NoReversal,'Value',1);
set(handles.Reversal,'Value',0);
set(handles.WithSymbolBit,'Value',1);
set(handles.WithoutSymbolBit,'Value',0);

ud.valR = 1;
ud.valS = 1;

% Parameters illuminating
hfig=findobj(allchild(0),'Name','FFTPlatForm');
h=get(hfig);
ud_h=h.UserData;
% ud.fn=ud_h.fn;
str0=ud_h.str;
str=[str0;str1;str2;str3;str4;str5;str6;str7;str8];
set(ud_h.hdl.Notes,'String',str);

hfig=findobj(allchild(0),'Name','FFTPlatForm');
set(hfig,'UserData',ud);

% Set Bin2Float Push Button enable on
set(ud_h.hdl.Bin2Float,'Enable','on');

close

⌨️ 快捷键说明

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