serialport - how to reopen port after handle was lost
10 ビュー (過去 30 日間)
古いコメントを表示
During replacing serial with serialport, I cannot open the port again after the handle was lost (e.g. because it was used in a function that terminated with an error).
I seem to be able to reset the port and reopen with serialport by using clear all but that cannot be it!? Isn't there something that works like delete(instrfind) for the older serial function?
In other words: what would i need between line 2 and line 3 if I lost the variable s:
clear all;
s=serialport('COM9',115200);
t=serialport('COM9',115200);
Error using serialport (line 116)
Unable to connect to the serialport device at port 'COM9'. Verify that a device is connected to the port, the port is not in use, and all serialport input arguments and parameter
values are supported by the device.
See related documentation for troubleshooting steps.
Please help!
0 件のコメント
回答 (1 件)
kate_w
2023 年 4 月 26 日
I found something that might help:
delete(instrfind({'Port'},{'COM9'}));
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!