from Using Instrument Drivers in MATLAB by Patrick Edson
Examples of using industry standard and MATLAB instrument drivers with the Instrument Control Toolbo

ivi_com_ex.m
% This script demonstrates using an IVI-COM driver for the first time.
% Once the MATLAB instrument driver wrapper is created, the first part of
% this script can be skipped.
%
% This examples assumes that you have installed the Tektronix TekScope
% IVI-COM driver.  You can substitute any other IVI-COM driver as
% applicable.

% NOTE: IVI drivers use a configuration store to map instrument resource names
% (hardware locations) to logical names.  This example assumes you have
% configured the IVI configuration store to include a logical name 'MyScope'
% that references a valid scope location.  For information on the IVI
% configuration store and configuring it from MATLAB, see the Instrument Control
% Toolbox documentation.

% Create the wrapper that allows the toolbox to communicate with the driver.
makemid('MyScope', 'MyTekDriver');

% Create a device object to represent the instrument driver functions and
% properties in MATLAB.  Pass the instrument location (a VISA resource name) as
% the second argument to the constructor.  There is no second argument because
% the IVI logical name contained in the 'MyTekDriver' driver contains all of the
% information needed to idenfity both the driver and location of the instrument.
deviceObj = icdevice('MyTekDriver');

% Connect to the device.  This calls Initialize() in the driver.
connect(deviceObj); 

% View basic information about the object and driver
display(deviceObj)

% View all of the root object properties
get(deviceObj)

% View all of the root object functions
methods(deviceObj)

% View the methods of one of the group objects. A group object is a special
% property of the device object that contains other properties and functions.
% The groups are based on how functions are categorized in the driver.
groupObj = get(deviceObj, 'Acquisition');
methods(groupObj)

% View the help for a specific driver function.
instrhelp(groupObj, 'AutoSet')

% Invoke a specific driver function.
invoke(groupObj, 'AutoSet');

% Cleanup
disconnect(deviceObj);
delete(deviceObj);

Contact us at files@mathworks.com