How can I pass the following visa TCPIP constructor by IP address variable.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
The expression:
PS1_obj = visa('NI','TCPIP0::192.168.200.50::inst0::INSTR')...it works as a literal expression but when I try to pass in a variable for the IP address the visa constructor errors.
Example:
ipaddr = '192.168.200.50'
PS1_obj = visa('NI','TCPIP0::%s::inst0::INSTR',ipaddr)...with variable declaration for the IP address.
Error using visa (line 293)
Invalid property: '192.168.200.50' specified.
0 Kommentare
Antworten (2)
Walter Roberson
am 19 Jan. 2019
Use sprintf to construct the character vector. The visa() function itself has no provision for substitution of strings.
1 Kommentar
Walter Roberson
am 21 Jan. 2019
PS1_obj = visa('NI', sprintf('TCPIP0::%s::inst0::INSTR',ipaddr) )
Siehe auch
Kategorien
Mehr zu Instrument Control Toolbox Supported Hardware finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!