Code covered by the BSD License  

Highlights from
Educational Lab Report Data Acquisition Example

image thumbnail

Educational Lab Report Data Acquisition Example



13 Feb 2006 (Updated )

This is an example on how one might use the notebook feature to create a lab to do data acquisition

Editor's Notes:

This file was a File Exchange Pick of the Week

function instOutput = simpleIC(freq)

%MYINSTRSESSION M-Code for communicating with an instrument. 
%   This is the machine generated representation of an instrument control 
%   session using a device object. The instrument control session comprises  
%   all the steps you are likely to take when communicating with your  
%   instrument. These steps are:
%       1. Create a device object   
%       2. Connect to the instrument 
%       3. Configure properties 
%       4. Invoke functions 
%       5. Disconnect from the instrument 
%   To run the instrument control session, type the name of the M-file,
%   myinstrsession, at the MATLAB command prompt.
%   The M-file, MYINSTRSESSION.M must be on your MATLAB PATH. For additional information
%   on setting your MATLAB PATH, type 'help addpath' at the MATLAB command
%   prompt.
%   Example:
%       myinstrsession;
%   See also ICDEVICE.

%   Creation time: 26-Oct-2005 12:47:34 

% Create a GPIB object.
interfaceObj = instrfind('Type', 'gpib', 'BoardIndex', 0, 'PrimaryAddress', 4, 'Tag', '');

% Create the GPIB object if it does not exist
% otherwise use the object that was found.
if isempty(interfaceObj)
    interfaceObj = gpib('ICS', 0, 4);
    interfaceObj = interfaceObj(1);

% Create a device object. 
deviceObj = icdevice('agilent_33120a.mdd', interfaceObj);

% Connect device object to hardware.

% Get old property value(s).
oldfreq = get(deviceObj, 'Frequency');

% Configure property value(s).
set(deviceObj, 'Frequency', freq);

% Get old property value(s).
newfreq = get(deviceObj, 'Frequency');

% Disconnect device object from hardware.

% Delete objects.
delete([deviceObj interfaceObj]);

instOutput.oldFrequency = oldfreq;
instOutput.newFrequency = newfreq;

Contact us