フィルターのクリア

How can I pass the following visa TCPIP constructor by IP address variable.

1 回表示 (過去 30 日間)
Steve Kulakowski
Steve Kulakowski 2019 年 1 月 19 日
コメント済み: Walter Roberson 2019 年 1 月 21 日
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.

回答 (2 件)

Walter Roberson
Walter Roberson 2019 年 1 月 19 日
Use sprintf to construct the character vector. The visa() function itself has no provision for substitution of strings.
  1 件のコメント
Walter Roberson
Walter Roberson 2019 年 1 月 21 日
PS1_obj = visa('NI', sprintf('TCPIP0::%s::inst0::INSTR',ipaddr) )

サインインしてコメントする。


Steve Kulakowski
Steve Kulakowski 2019 年 1 月 21 日
Thanks for the response, I tried that but it didn't work. I didn't spend alot of time on it, so let me double check the string.....

カテゴリ

Help Center および File ExchangeInstrument Control Toolbox についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by