Instrument Control Toolbox | ![]() ![]() |
Creating an Instrument Object
Instrument objects are the toolbox components you use to access your instrument. They provide a gateway to the functionality of your instrument, and allow you to control the behavior of your instrument control application. Each instrument object is associated with a specific interface standard, one instrument, and possibly additional hardware such as a GPIB or VXI controller.
To create an instrument object, you call M-file functions called object creation functions (or object constructors). These M-files are implemented using MATLAB's object-oriented programming capabilities, which are described in MATLAB Classes and Objects" in the Help browser. The supported instrument objects are listed below.
Constructor |
Description |
gpib |
Create a GPIB object. |
serial |
Create a serial port object. |
visa |
Create a VISA-GPIB, VISA-VXI, VISA-GPIB-VXI, or VISA-serial object. |
You can find out how to create an instrument object for a particular interface and adaptor with the ObjectConstructorName
field of the instrhwinfo
function. For example, to find out how to create a GPIB object for a National Instruments GPIB controller
out = instrhwinfo('gpib','ni'); out.ObjectConstructorName ans = gpib('ni', <BID>, <PR>)
The constructor syntax tells you that you must supply the GPIB controller's board index and the instrument's primary address to the gpib
function. For example, to create a GPIB object with board index 0 and primary address 1
g = gpib('ni',0,1);
![]() | The Instrument Control Session | Configuring Properties During Object Creation | ![]() |