tcpclient object with/without Instrument toolbox

So, there are two different tcpclient type of objects: one corresponding to the stand-alone Matlab installation and one implemented by the addition of the Instrument Control Toolbox:
They are not really the same, for example the one from the Instrument Control Toolbox has the writeread method, whereas the other does not.
What I find weird is that on a matlab installation without the Instrument Control Toolbox installed, I can still use the writeread method of the object (and it works as expected!).
How can this be?!?
Admittedly, I did have the Instrument Control Toolbox installed on the machine (but I uninstalled it due to other reasons). Yet, I would have expected the writeread method not to be recognized anymore, after the removal of the toolbox.
Regards,
Cristian

3 Comments

As a matter of fact, the very same observation can also be made about serialport objects:
https://ch.mathworks.com/help/instrument/serialport.html
Hi,
It is my understanding that you are observing that the 'writeread' method remains available for 'tcpclient' (and similarly for serialport) even after uninstalling Instrument Control Toolbox.
This is an interesting observation, especially since it involves behaviour persisting after removal of a product. As this may depend on the specifics of the installation, environment, or underlying implementation, it would be best to have this investigated further.
I recommend reaching out to MathWorks Technical Support, so that this scenario can be reviewed in detail. If this behaviour is expected, clarification in the documentation would also be helpful.
Well, inside the C:\Program Files\MATLAB\R2026a\toolbox\matlab\networklib\interface\tcpclient.m there is indeed a writeread function defined.
And I am quite certain this is the file implementing the class I am using, based on this prompt:
K>> which tcpclient -all
C:\Program Files\MATLAB\R2026a\toolbox\matlab\networklib\interface\tcpclient.m % tcpclient constructor
The puzzling thing is that inside the comments of this method, you find this line nin the last row of the Notes section (just before Example): WRITEREAD REQUIRES INSTRUMENT CONTROL TOOLBOX. Still, seems I am able to call it.
function response = writeread(obj,varargin)
%WRITEREAD Writes ASCII-terminated string command to remote host and
% reads back an ASCII-terminated string.
% This function can be used to query the remote host.
%
% RESPONSE = WRITEREAD(OBJ,COMMAND) writes the COMMAND
% followed by the write terminator to the remote host. It reads
% back the RESPONSE from the remote host, which is an
% ASCII-terminated string, and returns the RESPONSE after removing
% the read terminator.
%
% Input Arguments:
% COMMAND: The ASCII-terminated data that is written to the
% remote host.
%
% Output Arguments:
% RESPONSE: The ASCII-terminated data that is returned back
% from the remote host.
%
% Notes:
% WRITEREAD waits until the ASCII-terminated COMMAND is written
% and an ASCII-terminated RESPONSE is retuned from the remote host.
% WRITEREAD REQUIRES INSTRUMENT CONTROL TOOLBOX™.
%
% Example:
% % Query the remote host for a response by sending "IDN?"
% % command.
% response = writeread(t,"*IDN?");

Sign in to comment.

Answers (0)

Categories

Products

Release

R2026a

Tags

Asked:

on 17 Jun 2026 at 9:36

Commented:

on 25 Jun 2026 at 12:47

Community Treasure Hunt

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

Start Hunting!