Cannot create serial port: Error using serial (line 120)?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Whos en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!