Cannot create serial port: Error using serial (line 120)?
2 次查看(过去 30 天)
显示 更早的评论
Hi, I have been using MATLAB to connect to a virtual USB serial port for the past few months. However, today I have started to get this error message:
Error using serial (line 120) Cannot create: No constructor with appropriate signature exists in Java class com.mathworks.toolbox.instrument.SerialComm
.
Below is the code I am using:
AComPort = GetAvailableComPort; % Get all available com ports. (borrowed function, can be found online)
y = length(AComPort); % Get how many com ports are available
SPort = AComPort(y); % By default choose last port on list
BRate = 115200; % By default choose 115200 baud rate
myComPort = InitPort(SPort,BRate); % Initialise and open com port
.
This is my own function for initialising ports:
function [ myComPort ] = InitPort( SPort, BRate )
%InitPort - Initialises a com port
obj=instrfind; % Clear all com ports ensuring they are available
if ~isempty(obj);
delete(obj);
end;
myComPort = serial(SPort,'BaudRate',BRate,'DataBits',8,'StopBits',1,'Terminator',0);
% Initialise a port called myComPort
fopen(myComPort); % Open port for read/write
end
.
Neither logging off and logging back in again or re-starting the computer have helped.
This is making it impossible for me to connect to the serial device. Does anyone have any ideas on how to solve this issue?
Thanks,
Jasmine
7 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!