How can I open a port in Matlab 2021 version?

4 vues (au cours des 30 derniers jours)
Oscar Medina Boone
Oscar Medina Boone le 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.

Réponses (1)

Cris LaPierre
Cris LaPierre le 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);

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by