Main Content

GPIB Interface

Communicate with instruments that support the GPIB interface

GPIB is a standardized interface that allows you to connect and control multiple devices from various vendors. For many GPIB applications, you can communicate with your instrument without detailed knowledge of how GPIB works. Communication is established through a GPIB object, gpib, which you create in the MATLAB® workspace. For information about creating the gpib object, see Creating a GPIB Object.

You can write and read both binary and text data. For examples of both, see Writing and Reading Data.


binblockreadRead binblock data from instrument
binblockwriteWrite binblock data to instrument
clearRemove instrument objects from MATLAB workspace
clrdeviceClear instrument buffer
deleteRemove instrument objects from memory
dispDisplay instrument object summary information
fcloseDisconnect interface object from instrument
fopenConnect interface object to instrument
fprintfWrite text to instrument
fscanfRead data from instrument, and format as text
getInstrument object properties
gpibCreate GPIB object
instrhwinfoInformation about available hardware
instrresetDisconnect and delete all instrument objects
propinfoInstrument object property information
setConfigure or display instrument object properties
spollPerform serial poll on GPIB objects
triggerSend trigger message to instrument
fgetlRead line of text from instrument and discard terminator
fgetsRead line of text from instrument and include terminator
flushinputRemove data from input buffer
flushoutputRemove data from output buffer
freadRead binary data from instrument
fwriteWrite binary data to instrument
isvalidDetermine whether instrument objects are valid
inspectOpen Property Inspector
lengthLength of instrument object array
loadLoad instrument objects and variables into MATLAB workspace
methodsClass method names and descriptions
obj2mfileConvert instrument object to MATLAB code
queryWrite text to instrument, and read data from instrument
readasyncRead data asynchronously from instrument
recordRecord data and event information to file
saveSave instrument objects and variables to MAT-file
scanstrRead data from instrument, format as text, and parse
sizeSize of instrument object array
stopasyncStop asynchronous read and write operations
instrcallbackDisplay event information when event occurs
instrfindRead instrument objects from memory to MATLAB workspace
instrfindallFind visible and hidden instrument objects
instrhelpHelp for instrument object type, function, or property
instridDefine and retrieve commands that identify instruments
instrnotifyDefine notification for instrument events


Test and Measurement ToolControl oscilloscopes and other instruments

Examples and How To

Creating a GPIB Object

The GPIB object establishes a connection to an instrument via its GPIB interface.

Configuring the GPIB Address

The GPIB address consists of the board index of the GPIB controller, and the primary address and (optionally) the secondary address of the instrument.

Writing and Reading Data

Rules for read and write operations with GPIB and examples of writing and reading both text and binary data.

Events and Callbacks

Enhance your instrument control communication using events and callbacks.


Send the GET (Group Execute Trigger) GPIB command to the instrument. This command instructs all addressed Listeners to perform a specified action.

Serial Polls

Execute a serial poll where the Controller asks (polls) each addressed Listener to send back a status byte that indicates whether it has asserted the SRQ line and needs servicing.


GPIB Overview

Basic features of the General Purpose Interface Bus (GPIB).

Driver Requirements

Required versions of vendors' drivers.

GPIB Driver Limitations by Vendor

Known limitations with supported GPIB drivers.

Instrument Control Toolbox Properties

These properties are available in the toolbox.


Troubleshooting GPIB Interface

Try these tips if you have problems using the toolbox with the GPIB interface. Includes information about GPIB supported platforms, adaptor requirements, configuration and connection, and other interface-specific tips.