| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Instrument Control Toolbox |
| Contents | Index |
| Learn more about Instrument Control Toolbox |
| On this page… |
|---|
The TCP/IP interface is supported through a VISA-TCP/IP object. The features associated with a VISA-TCP/IP object are similar to the features associated with a tcpip object. Therefore, only functions and properties that are unique to VISA's TCP/IP interface are discussed in this section.
Refer to Controlling Instruments Using TCP/IP and UDP, to learn about writing and reading text and binary data, using events and callbacks, and so on.
You create a VISA-TCPIP object with the visa function. Each VISA-TCPIP object is associated with an instrument connected to your computer.
visa requires the vendor name and the resource name as input arguments. The vendor name can be agilent, ni, or tek. The resource name consists of the TPC/IP board index, IP address or host name, and LAN device name of your instrument. You can find the VISA-TCPIP resource name for a given instrument with the configuration tool provided by your vendor, or with the instrhwinfo function. (In place of the resource name, you can use an alias as defined with your VISA vendor configuration tool.) As described in Connecting to the Instrument, you can also configure property values during object creation.
Before you create a VISA object, you must find the instrument in the appropriate vendor VISA explorer. When you find the instrument configured, note the resource string and create the object using that information. For example, to create a VISA-TCPIP object that uses National Instruments VISA associated with an instrument at IP address 216.148.60.170,
vt = visa('ni','TCPIP::216.148.60.170::INSTR');The VISA-TCPIP object vt now exists in the MATLAB workspace.
To open an connection to the instrument, type:
fopen (vt);
You can display the class of vt with the whos command.
whos vt Name Size Bytes Class vt 1x1 886 visa object Grand total is 17 elements using 886 bytes
After you create the VISA-TCPIP object, the properties listed below are automatically assigned values. These properties provide descriptive information about the object based on its class type and address information.
VISA-TCPIP Descriptive Properties
Property Name | Description |
|---|---|
Specify a descriptive name for the VISA-TCPIP object. | |
Indicate the resource name for a VISA instrument. | |
Indicate the object type. |
You can display the values of these properties for vt with the get function.
get(vt,{'Name','RsrcName','Type'})
ans =
'VISA-TCPIP-216.148.60.170' 'TCPIP::216.148.60.170::INSTR'
'visa-tcpip'The VISA-TCPIP object provides you with a convenient display that summarizes important address and state information. You can invoke the display summary these three ways:
Type the VISA-TCPIP object at the command line.
Exclude the semicolon when creating a VISA-TCPIP object.
Exclude the semicolon when configuring properties using the dot notation.
You can also display summary information via the Workspace browser by right-clicking an instrument object and selecting Display Summary from the context menu.
The display summary for the VISA-TCPIP object vt is given below.
VISA-TCPIP Object Using NI Adaptor : VISA-TCPIP-216.148.60.170 Communication Address RemoteHost: 216.148.60.170 Communication State Status: closed RecordStatus: off Read/Write State TransferStatus: idle BytesAvailable: 0 ValuesReceived: 0 ValuesSent: 0
The VISA-TCPIP address consists of
Board index (optional, from the VISA configuration)
Remote host of the instrument
LAN device name of the instrument (optional)
You specify these address property values via the resource name during VISA-TCPIP object creation. The instrument address properties are given below.
VISA-TCPIP Address Properties
Property Name | Description |
|---|---|
Specify the index number of the TCP/IP board in VISA configuration (optional — defaults to 0). | |
Specify the remote host name or IP address of the instrument. | |
Specify the LAN device name of the instrument. |
The properties are automatically updated with the specified resource name values when you create the VISA-TCPIP object.
With the get function, you can display the address property values for the VISA-TCPIP object vt, created in Creating a VISA-TCPIP Object.
fopen(vt)
get(vt,{'RemoteHost'})
ans =
[216.148.60.170]
![]() | Working with the USB Interface | Working with the RSIB Interface | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |