How to use tcpclient instead of tcpip with icdevice

10 ビュー (過去 30 日間)
yash
yash 2024 年 7 月 12 日
コメント済み: Marouane 2024 年 11 月 4 日 14:35
I am using instrfind and tcpip to create interface object. I am pasing this interface object in icdevice to create object of my matlab intrument device driver. As, instrfind and tcpip will be removed in future release, how can I modify my code to use my instrument device driver? If I replace tcpip with tcpclient then I cannot use icdevice to create object of my intrument device driver. Refer below code which I am using.
% Create a TCPIP object.
interfaceObj = instrfind('Type', 'tcpip', 'RemoteHost', '127.0.0.1', 'RemotePort', 1234, 'Tag', '');
% Create the TCPIP object if it does not exist
% otherwise use the object that was found.
if isempty(interfaceObj)
interfaceObj = tcpip('127.0.0.1', 1234);
else
fclose(interfaceObj);
interfaceObj = interfaceObj(1);
end
% Create a device object.
deviceObj = icdevice('my_driver.mdd', interfaceObj);
% Connect device object to hardware.
connect(deviceObj);

回答 (1 件)

Sachin Lodhi
Sachin Lodhi 2024 年 7 月 16 日
Hi Yash,
I understand that you are currently using 'instrfind' and 'tcpip' in your code, and since these functions will be deprecated, you want to know how to use 'tcpclient' instead.
The 'instrfind' and 'instrfindall' functions will be removed in future releases. You should use 'tcpclientfind' instead. The 'tcpclientfind' function identifies existing TCP/IP client connections and returns an array of 'tcpclient' objects corresponding to each connection. You can then use these 'tcpclient' objects to connect to your hardware.
For more information on 'tcpclientfind' and transitioning to 'tcpclient', please refer to the following documentation:
I hope this helps!
  2 件のコメント
yash
yash 2024 年 7 月 16 日
編集済み: yash 2024 年 7 月 17 日
Yes I can use tcpclientfind instead of instrfind and can replace tcpip with tcpclient but icdevice will need tcpip object. So, is there any other way to create device object? Also, currently I am using 2023a version of Matlab, can you provide me details on which revesion tcpip function will be removed? Like is it available in 2024a or not? And if you can provide me alternate way of using my current interface instrument driver with tcpclient it will be a great help.
Marouane
Marouane 2024 年 11 月 4 日 14:35
Hi Yash,
I'm encountering the same issue with icdevice in MATLAB 2024. Were you able to find a solution? Thanks in advance!

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

カテゴリ

Help Center および File ExchangeInstrument Connection and Communication についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by