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

📄 advfigure.m

📁 MATLAB是一个非常好的用于测量
💻 M
📖 第 1 页 / 共 2 页
字号:
function varargout = ADVFigure(varargin)
% ADVFIGURE M-file for ADVFigure.fig
%      ADVFIGURE, by itself, creates a new ADVFIGURE or raises the existing
%      singleton*.
%
%      H = ADVFIGURE returns the handle to a new ADVFIGURE or the handle to
%      the existing singleton*.
%
%      ADVFIGURE('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in ADVFIGURE.M with the given input arguments.
%
%      ADVFIGURE('Property','Value',...) creates a new ADVFIGURE or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before ADVFigure_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to ADVFigure_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 ADVFigure

% Last Modified by GUIDE v2.5 05-Dec-2007 13:51:45

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @ADVFigure_OpeningFcn, ...
                   'gui_OutputFcn',  @ADVFigure_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


%*******************************************************************
% OpeningFcn Callback
%
% Executes just before ADVFigure is made visible.  This function
% also performs the required initialization for the advanced
% data visualization functions.
%*******************************************************************
function ADVFigure_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 ADVFigure (see VARARGIN)

global g_ADVMXAHandle
global g_ADVClosing

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

% Update handles structure
guidata(hObject, handles);

%*-------------------------------------------------------------*
%  Initialize data visualization
%*-------------------------------------------------------------*
ADV_Initialize();
g_ADVClosing = 0;

%*-------------------------------------------------------------*
%  Set figure defaults
%*-------------------------------------------------------------*
set( handles.advFigure, ...
    'DefaultAxesColor', [0,0,0], ...
    'DefaultAxesXColor', [0, 0, 0], ...
    'DefaultAxesYColor', [0.5, 0.5, 0.5], ...
    'DefaultAxesZColor', [0.5, 0.5, 0.5], ...
    'DefaultAxesGridLineStyle', 'none', ...
    'KeyPressFcn', @ADVFigure_keypress, ...
    'DefaultUicontrolKeyPressFcn', @ADVFigure_keypress );

set( handles.button1, 'KeyPressFcn', @ADVFigure_keypress );
set( handles.button2, 'KeyPressFcn', @ADVFigure_keypress );
set( handles.button3, 'KeyPressFcn', @ADVFigure_keypress );
set( handles.button4, 'KeyPressFcn', @ADVFigure_keypress );
set( handles.button5, 'KeyPressFcn', @ADVFigure_keypress );
set( handles.button6, 'KeyPressFcn', @ADVFigure_keypress );
set( handles.button7, 'KeyPressFcn', @ADVFigure_keypress );
set( handles.agilentLabel, 'KeyPressFcn', @ADVFigure_keypress );

%*-------------------------------------------------------------*
%  Add GUI data to the handles structure
%*-------------------------------------------------------------*

% menuNumber indicates the current softkey menu selection.  Possible 
% values are:
%  0 - Main menu
%  1 - Display mode selection

handles.menuNumber = 0;

% displayMode indicates the active display mode.  Possible values
% are:
%  0 = Analog advanced (default)
%  1 = Analog plus
%  2 = Waterfall
%  3 = Spectrogram
handles.displayMode = 0;

% timer stores a handle to the timer object
handles.timer = 0;

% Save the GUI data
guidata( handles.advFigure, handles );

% Update the display mode
ADV_SetDisplayMode( g_ADVMXAHandle, 0, handles );

% Show the main menu
ShowMainMenu( handles );



function ADVFigure_keypress( source, event )

handles = guidata( gcf );
if length(event.Modifier) == 2 && ...
        strcmp(event.Modifier(1), 'shift') && ...
        strcmp(event.Modifier(2), 'control')
    
    if strcmp( event.Key, 'f1' )
        button1_Callback( 0, event, handles );
    
    elseif strcmp( event.Key, 'f2' )
        button2_Callback( 0, event, handles );
        
    elseif strcmp( event.Key, 'f3' )
        button3_Callback( 0, event, handles );
        
    elseif strcmp( event.Key, 'f4' )
        button4_Callback( 0, event, handles );
        
    elseif strcmp( event.Key, 'f5' )
        button5_Callback( 0, event, handles );
        
    elseif strcmp( event.Key, 'f6' )
        button6_Callback( 0, event, handles );
        
    elseif strcmp( event.Key, 'f7' )
        button7_Callback( 0, event, handles );
    end
end


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


%*******************************************************************
% Button1 Callback
%
% This function is called when the user clicks on the first softkey
% button.  Its functionality depends on the current menu selection,
% defined by the menuNumber variable.
%*******************************************************************
function button1_Callback(hObject, eventdata, handles)
% hObject    handle to button1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


%*******************************************************************
% Button2 Callback
%
% This function is called when the user clicks on the second softkey
% button.  Its functionality depends on the current menu selection,
% defined by the menuNumber variable.
%*******************************************************************
function button2_Callback(hObject, eventdata, handles)
% hObject    handle to button2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


global g_ADVMXAHandle

if handles.menuNumber == 0
    %*---------------------------------------------------*
    %  Display mode button was pressed in the main menu.
    %*---------------------------------------------------*
    for i=0:3
        % Determine the text and button handle
        switch i
            case 0
                buttonText = 'Analog Adv';
                handle = handles.button2;
            case 1
                buttonText = 'Analog Plus';
                handle = handles.button3;
            case 2
                buttonText = 'Waterfall';
                handle = handles.button4;
            case 3
                buttonText = 'Spectrogram';
                handle = handles.button5;
        end
        
        % If this is the current display mode, make the text bold
        if i == handles.displayMode
            fontWeight = 'bold';
        else
            fontWeight = 'normal';
        end
        
        % Update the button
        set( handle, 'String', buttonText, 'Visible', 'on', 'FontWeight', fontWeight' );
    end

    % Add the return menu
    set( handles.button6, 'Visible', 'off' );
    set( handles.button7, 'String', 'Return', 'Visible', 'on' );
    
    % Update the menu number
    handles.menuNumber = 1;
    guidata( handles.advFigure, handles );

elseif handles.menuNumber == 1
    %*---------------------------------------------------*
    %  Analog advanced button was pressed in the
    %  display mode menu.
    %*---------------------------------------------------*    
    % Change mode to analog advanced
    handles.displayMode = 0;
    ADV_SetDisplayMode( g_ADVMXAHandle, 0, handles );
    guidata( handles.advFigure, handles );
    
    % Update timer user data
    if handles.timer ~= 0 
        set( handles.timer, 'UserData', handles );
    end

    % Switch to the main menu
    ShowMainMenu( handles );
end

% --- Executes on button press in button3.
function button3_Callback(hObject, eventdata, handles)
% hObject    handle to button3 (see GCBO)

⌨️ 快捷键说明

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