Main Content

Use IVI-C Class-Compliant Drivers

The IVI-C class-compliant MATLAB® drivers provide an interface to MATLAB for instruments running on IVI-C class-compliant drivers. For a list of supported IVI-C class-compliant drivers, see Supported IVI Drivers.

This example uses a specific instrument, a Keysight™ MSO6104A oscilloscope. This feature works with any IVI-C class-compliant instrument. You can follow the basic steps, using your particular instrument if the device is IVI-C class-compliant.


To use the driver you must have the following software installed.

  • Windows® 64-bit

  • VISA shared components

  • VISA (The following example uses Keysight VISA, but you can use any version of VISA.)

  • National Instruments™ compliance package NICP 4.1

  • Your instrument driver

  • Instrument Control Toolbox™ Support Package for IVI® and VXIplug&play Drivers

You can use instrhwinfo to confirm that these software modules are installed.


Read Waveforms Using the IVI-C Class-Compliant Interface

This example shows the general workflow to use with an IVI-C class-compliant device. This example uses a Keysight MSO6104A oscilloscope. This feature works with any IVI-C class-compliant instrument. You can follow the basic steps using your particular instrument if it is IVI-C class-compliant.

  1. Ensure all necessary software is installed. See Prerequisites for the list.

  2. Ensure that your instrument is recognized by the VISA utility. In this case, open Keysight Connectivity Expert and make sure it recognizes the oscilloscope.

  3. Set up the logical name using the Configuration Store. The VISA resource string shown in this code was acquired from the VISA utility in step 2.

    % Construct a configStore.
    configStore = iviconfigurationstore;
    % Set up the hardware asset called myScopeHWAsset, and resource description TCPIP0::a-m6104a-004598::INSTR.
    add(configStore, 'HardwareAsset', 'myScopeHWAsset', 'TCPIP0::a-m6104a-004598::INSTR');
    % Add a driver session called myScopeSession, and use the asset created in the step above. Ag546XX is the Agilent driver version. 
    add(configStore, 'DriverSession', 'myScopeSession', 'Ag546XX', 'myScopeHWAsset');
    % Add a logical name to the configStore called myScope and driver session called myScopeSession.
    add(configStore, 'LogicalName', 'myScope', 'myScopeSession');
    % Save the changes to the IVI configuration store data file.
    % You can verify that the steps you just performed worked.
    logicalNameInfo = instrhwinfo('ivi', 'myscope')

    For more information about the configuration store, see IVI Configuration Store.

  4. Connect to the instrument.

    dev = ividev("IviScope","myScope","IDQuery",true,"ResetDevice",true);
  5. Communicate with the instrument. For example, read a waveform.

    % Reset the instrument to a known state and automatically configure the measurement parameters.
    % Create a record length variable. 
    recordLength = actualRecordLength(dev)
    % Read a waveform with channel name set to channel1 and timeout to 1000. 
    waveformArray = readWaveform(dev,"Channel1",recordLength,1000)
    % Plot the waveform and assign labels for the plot. 
  6. After configuring the instrument and retrieving its data, close the session and remove it from the workspace.

    clear dev

IVI-C Class-Compliant Drivers in Test & Measurement Tool

You can also use the IVI-C Class-Compliant Drivers functionality from the Test & Measurement Tool. View the IVI-C nodes by setting a preference in MATLAB.

  1. In MATLAB, on the Home tab, in the Environment section, click Preferences. Then select Instrument Control in the Preferences dialog box.

  2. Select the Show IVI Instruments in TMTool option in the IVI Instruments section.

    If you do not have the required software installed, you will get a message indicating that. See Prerequisites for the list of required software.

  3. Start the Test & Measurement Tool (using the tmtool function), and the new IVI Instruments node appears under Instrument Drivers.

For information on using it in the Test & Measurement Tool, see the Help within the tool by selecting the IVI Instruments node in the tree once it is visible after setting the MATLAB preference.

See Also