Code covered by the BSD License  

Highlights from
MATLAB GUI Example for Agilent N8241A Arbitrary Waveform Generator

image thumbnail
fcngen_gui(varargin)
function varargout = fcngen_gui(varargin)
% FCNGEN_GUI M-file for fcngen_gui.fig
%      FCNGEN_GUI, by itself, creates a new FCNGEN_GUI or raises the existing
%      singleton*.
%
%      H = FCNGEN_GUI returns the handle to a new FCNGEN_GUI or the handle to
%      the existing singleton*.
%
%      FCNGEN_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in FCNGEN_GUI.M with the given input arguments.
%
%      FCNGEN_GUI('Property','Value',...) creates a new FCNGEN_GUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before fcngen_gui_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to fcngen_gui_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 fcngen_gui

% Last Modified by GUIDE v2.5 12-Sep-2007 18:23:53

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @fcngen_gui_OpeningFcn, ...
                   'gui_OutputFcn',  @fcngen_gui_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 fcngen_gui is made visible.
function fcngen_gui_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 fcngen_gui (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = fcngen_gui_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 pscan_startFreqEdit_Callback(hObject, eventdata, handles)
% hObject    handle to pscan_startFreqEdit (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 pscan_startFreqEdit as text
%        str2double(get(hObject,'String')) returns contents of pscan_startFreqEdit as a double


% --- Executes during object creation, after setting all properties.
function pscan_startFreqEdit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pscan_startFreqEdit (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 slider movement.
function pscan_startFreqSlider_Callback(hObject, eventdata, handles)
% hObject    handle to pscan_startFreqSlider (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function pscan_startFreqSlider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pscan_startFreqSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



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


% --- Executes during object creation, after setting all properties.
function pscan_endFreqEdit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pscan_endFreqEdit (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 slider movement.
function pscan_endFreqSlider_Callback(hObject, eventdata, handles)
% hObject    handle to pscan_endFreqSlider (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function pscan_endFreqSlider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pscan_endFreqSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



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


% --- Executes during object creation, after setting all properties.
function pscan_incrFreqEdit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pscan_incrFreqEdit (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 slider movement.
function pscan_incrFreqSlider_Callback(hObject, eventdata, handles)
% hObject    handle to pscan_incrFreqSlider (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function pscan_incrFreqSlider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pscan_incrFreqSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


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


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


% --- Executes on selection change in genwf_waveShapePopup.
function genwf_waveShapePopup_Callback(hObject, eventdata, handles)
% hObject    handle to genwf_waveShapePopup (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 genwf_waveShapePopup contents as cell array
%        contents{get(hObject,'Value')} returns selected item from genwf_waveShapePopup


% --- Executes during object creation, after setting all properties.
function genwf_waveShapePopup_CreateFcn(hObject, eventdata, handles)
% hObject    handle to genwf_waveShapePopup (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');
end



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


% --- Executes during object creation, after setting all properties.
function genwf_startFreqEdit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to genwf_startFreqEdit (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 slider movement.
function genwf_startFreqSlider_Callback(hObject, eventdata, handles)
% hObject    handle to genwf_startFreqSlider (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function genwf_startFreqSlider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to genwf_startFreqSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



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


% --- Executes during object creation, after setting all properties.
function genwf_endFreqEdit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to genwf_endFreqEdit (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 slider movement.
function genwf_endFreqSlider_Callback(hObject, eventdata, handles)
% hObject    handle to genwf_endFreqSlider (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function genwf_endFreqSlider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to genwf_endFreqSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



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


% --- Executes during object creation, after setting all properties.
function genwf_chirpDurEdit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to genwf_chirpDurEdit (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 slider movement.
function genwf_chirpDurSlider_Callback(hObject, eventdata, handles)
% hObject    handle to genwf_chirpDurSlider (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function genwf_chirpDurSlider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to genwf_chirpDurSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


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


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


Contact us at files@mathworks.com