Instrument Control Toolbox

Using SCPI Commands from MATLAB

Control Instruments using SCPI Commands

MATLAB supports the programming of instruments using SCPI commands through Instrument Control Toolbox. Once data is in MATLAB, you can analyze and visualize the data for analysis tasks such as signal processing, statistical analysis, digital filtering, and curve fitting. You can also create graphical interfaces for collecting and analyzing your data and automating tests.

SCPI (Standard Commands for Programmable Instruments) defines a syntax and text-based commands for controlling programmable test and measurement instruments.

Commands Functionality
*CLS Clear the status
*ESE Enable standard event
*ESE? Query if event is enabled and standard
*ESR? Query standard event status register
*IDN? Query instrument identification
*OPC Operation complete
*OPC? Query if operation is complete
*RST Instrument reset
*SRE Query id service request is enabled
*STB? Query read of status byte
*TST? Query instrument self-test
*WAI Wait to continue

Commonly used SCPI commands

You can program instruments directly from MATLAB using SCPI commands and Instrument Control Toolbox. The SCPI standard does not define a physical interface and can be used over several different physical interfaces from MATLAB, such as:

SCPI commands are ASCII-based and can be sent directly from MATLAB using the toolbox and the fprintf and fscanf commands and the associated command for the interface.

MATLAB code showing how to capture data from a Tektronix oscilloscope over a Serial connection using SCPI commands