How can I open a port in Matlab 2021 version?

10 views (last 30 days)
Oscar Medina Boone
Oscar Medina Boone on 10 Nov 2021
Answered: Cris LaPierre on 10 Nov 2021
In the following program I need to start a connection with a COM port, but I'm getting this error on line 22, and I think is because I dont have the right syntax, can somebody tell me how should I write it in MATLAB 2021.

Answers (1)

Cris LaPierre
Cris LaPierre on 10 Nov 2021
You do not need to use fopen when using serialport.
As an example, the equivalent for the following code using serial
s = serial("COM1");
s.BaudRate = 115200;
fopen(s)
is this using serialport
s = serialport("COM1",115200);

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by