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.
i2c | Create I2C object |
spi | Create SPI object |
tcpclient | Create TCP/IP client connection with TCP/IP server |
udpport | Connect to UDP socket |
serialport | Connection to serial port |
tmtool | Open Test & Measurement Tool |
fclose | Disconnect interface object from instrument |
fopen | Connect interface object to instrument |
fprintf | Write text to instrument |
fread | Read binary data from instrument |
fscanf | Read data from instrument, and format as text |
fwrite | Write binary data to instrument |
readasync | Read data asynchronously from instrument |
stopasync | Stop asynchronous read and write operations |
binblockread | Read binblock data from instrument |
binblockwrite | Write binblock data to instrument |
flushinput | Remove data from input buffer |
flushoutput | Remove data from output buffer |
get | Instrument object properties |
set | Configure or display instrument object properties |
propinfo | Instrument object property information |
disp | Display instrument object summary information |
instrhwinfo | Information about available hardware |
instrreset | Disconnect and delete all instrument objects |
clear | Remove instrument objects from MATLAB workspace |
delete | Remove instrument objects from memory |
fgetl | Read line of text from instrument and discard terminator |
fgets | Read line of text from instrument and include terminator |
inspect | Open Property Inspector |
instrcallback | Display event information when event occurs |
instrfind | Read instrument objects from memory to MATLAB workspace |
instrfindall | Find visible and hidden instrument objects |
instrhelp | Help for instrument object type, function, or property |
instrid | Define and retrieve commands that identify instruments |
instrnotify | Define notification for instrument events |
isvalid | Determine whether instrument objects are valid |
length | Length of instrument object array |
load | Load instrument objects and variables into MATLAB workspace |
methods | Class method names and descriptions |
obj2mfile | Convert instrument object to MATLAB code |
query | Write text to instrument, and read data from instrument |
record | Record data and event information to file |
save | Save instrument objects and variables to MAT-file |
scanstr | Read data from instrument, format as text, and parse |
size | Size of instrument object array |
Test and Measurement Tool | Control oscilloscopes and other instruments |
You need to create a MATLAB® object that represents the instrument to communicate with 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.
You can write text or binary data to the instrument and read text or binary data from the instrument.
You can use SCPI commands with the Instrument Control Toolbox™ and the MATLAB programming environment to control multiple instruments using similar functions.
Disconnect the object from the instrument, and remove the object from memory and from the workspace.