open serial ports using matlab web

19 visualizaciones (últimos 30 días)
Rolando Paz Herrera
Rolando Paz Herrera el 16 de Feb. de 2023
Comentada: Rolando Paz Herrera el 9 de Mzo. de 2023
I have some problems using serialport sentence in the online matlab enviroment. The serial port in windows it's called as 'COMx' but in linux is something like "/dev/ttySx" just like online matlab. So, when I try to open the port usin the sentence s = serialport("/dev/ttyS0", 115200) an error occurs saying Unable to connect to the serialport device at port '/dev/ttyS0', also happen using "COMx" instead. I gess that may be is some problems related with the access to the port of the computer from online matlab enviroment, but I don't know how fix it.

Respuestas (1)

Walter Roberson
Walter Roberson el 16 de Feb. de 2023
Editada: Walter Roberson el 16 de Feb. de 2023
MATLAB Online runs on a cloud somewhere. Your interface to it is through a web browser. The only part that runs on your own hardware is the web browser.
The only way for a web browser to access hardware that lives on your computer is by using an HTML5 interface. Security models in browsers have changed over the years so that JavaScript cannot access hardware except through specific interfaces. The only common browser that implements the interface is Chrome, and it is currently limited to playing sound and transferring some kinds of sensor data if I recall correctly.
In summary: there is no way for MATLAB Online to be able to access serial ports on your computer. That includes not being able to access arduino or raspberry pi.
(I have seen some hints that arduino connections might be available in the future.)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by