Specify primary address of GPIB instrument
For GPIB and VISA-GPIB objects, you configure PrimaryAddress to be the GPIB primary address associated with your instrument. The primary address can range from 0 to 30, and you must specify it during object creation using the gpib or visa function. For VISA-GPIB-VXI objects, PrimaryAddress is read-only, and the value is returned automatically by the VISA interface after the object is connected to the instrument with the fopen function.
For GPIB and VISA-GPIB objects, the Name property is automatically updated to reflect the PrimaryAddress value. For VISA-GPIB objects, the RsrcName property is automatically updated to reflect the PrimaryAddress value.
You can configure PrimaryAddress only when the GPIB or VISA-GPIB object is disconnected from the instrument. You disconnect a connected object with the fclose function. A disconnected object has a Status property value of closed.
GPIB, VISA-GPIB, VISA-GPIB-VXI
While open (GPIB, VISA-GPIB), always (VISA-GPIB-VXI)
PrimaryAddress can range from 0 to 30. The value is determined when the instrument object is created.
This example creates a VISA-GPIB object associated with board 0, primary address 1, and secondary address 8, and then returns the primary address.
vg = visa('agilent','GPIB0::1::8::INSTR'); vg.PrimaryAddress ans = 1