Connect interface object to instrument
An interface object or an array of interface objects.
to the instrument.
This example creates the GPIB object
g to the instrument using
and reads text data, and then disconnects
g from the
g = gpib('ni',0,1); fopen(g) fprintf(g,'*IDN?') idn = fscanf(g); fclose(g)
Before you can perform a read or write operation,
obj must be
connected to the instrument with the
fopen function. When
obj is connected to the instrument
Data remaining in the input buffer or the output buffer is flushed.
Status property is set to
BytesToOutput properties are set to 0.
An error is returned if you attempt to perform a read or write operation while
obj is not connected to the instrument. You can connect only
one interface object to a given instrument. For example, on a Windows® machine you can connect only one serial port object to an instrument
associated with the COM1 port. Similarly, you can connect only one GPIB object to an
instrument with a given board index, primary address, and secondary address.
Some properties are read-only while the interface object is connected, and must be
configured before using
fopen. Examples include
Refer to the property reference pages or use the
propinfo function to determine
which properties have this constraint.
The values for some properties are verified only after
connected to the instrument. If any of these properties are incorrectly configured,
an error is returned when
fopen is issued and
obj is not connected to the instrument. Properties of this
SecondaryAddress, and are associated with instrument
Not recommended starting in R2019b