Restart a USB connection

10 Ansichten (letzte 30 Tage)
Mathias Westlund
Mathias Westlund am 17 Jan. 2013
Verschoben: Walter Roberson am 23 Okt. 2025 um 2:53
Hi, I have a hardware intrument with a Matlab GUI that calls a few different USB devices. From time to time a USB connection fails. To resolve this I currently need to restart Matlab, the hardware or unplugg/replug the USB device. Is there a way to restart the USB communication from Matlab wihtout restarting any of the hardware or programs?
Thanks Mathias Westlund
  1 Kommentar
Mickael PIERRE
Mickael PIERRE am 12 Mär. 2021
Hi there,
I have the same issue. Did you find a way around it?
Thank you,
Mickael

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 18 Jan. 2013
Mathworks has said there is no current mechanism to do this.
A small number of people have reported success using instrreset, but that is part of the Instrument Control toolbox.
  1 Kommentar
Mathias Westlund
Mathias Westlund am 18 Jan. 2013
Verschoben: Walter Roberson am 23 Okt. 2025 um 2:53
Thanks Walter. I will investigate instrreset.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Gavin
Gavin am 22 Okt. 2025 um 23:08
See this same issue with a solution here
workaround exists: you can delete the existing serial port connection and then establish a new connection. For example:
myComPort = serial('COM5');
fopen(myComPort);
% Now disconnect the device
delete(myComPort);
clear myComPort;
% Reconnect the device; the following will now be successful:
myComPort = serial('COM5');
fopen(myComPort);

Kategorien

Mehr zu Instrument Control Toolbox Supported Hardware finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by