Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Interface-Based Communication

Communication using interfaces

With interface-based communication, there are common steps that comprise the basic workflow. You create an object of the interface type you are using, and connect to the instrument. Setting properties is optional, but common. You read and write data, and disconnect and clean up.

Functions

bluetoothCreate Bluetooth object
i2cCreate I2C object
spiCreate SPI object
tcpipCreate TCPIP object
udpCreate UDP object
serialCreate serial port object
tmtoolOpen Test & Measurement Tool
fcloseDisconnect interface object from instrument
fopenConnect interface object to instrument
fprintfWrite text to instrument
freadRead binary data from instrument
fscanfRead data from instrument, and format as text
fwriteWrite binary data to instrument
readasyncRead data asynchronously from instrument
stopasyncStop asynchronous read and write operations
binblockreadRead binblock data from instrument
binblockwriteWrite binblock data to instrument
flushinputRemove data from input buffer
flushoutputRemove data from output buffer
getInstrument object properties
setConfigure or display instrument object properties
propinfoInstrument object property information
dispDisplay instrument object summary information
instrhwinfoInformation about available hardware
instrresetDisconnect and delete all instrument objects
clearRemove instrument objects from MATLAB workspace
deleteRemove instrument objects from memory
fgetlRead line of text from instrument and discard terminator
fgetsRead line of text from instrument and include terminator
inspectOpen Property Inspector
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
isvalidDetermine whether instrument objects are valid
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
recordRecord data and event information to file
saveSave instrument objects and variables to MAT-file
scanstrRead data from instrument, format as text, and parse
serialCreate serial port object
sizeSize of instrument object array

Apps

Test and Measurement ToolControl oscilloscopes and other instruments

Topics

Creating an Interface Object

You need to create a MATLAB® object that represents the instrument to communicate with the instrument.

Connecting to the Instrument

Before you can use the instrument object to write or read data, you must connect it to the instrument whose address or port is specified in the creation function.

Configuring and Returning Properties

You can configure the instrument object behavior by assigning values to properties.

Writing and Reading Data

You can write text or binary data to the instrument and read text or binary data from the instrument.

Using SCPI Commands

You can use SCPI commands with the Instrument Control Toolbox™ and the MATLAB programming environment to control multiple instruments using similar functions.

Disconnecting and Cleaning Up

Disconnect the object from the instrument, and remove the object from memory and from the workspace.

Was this topic helpful?