简体   繁体   中英

Open Serial object slow in Matlab

I am using Matlab to communicate with a motor driver via serial connection. Everything works fine, except that creating and connecting-to the Serial Object is very slow. Approximately 30+ seconds.

I am defining the properties as instructed by the user manual for the motor driver. The following is the code I'm using to open and connect to the serial object.

S = serial('COM1', 'baudrate', 9600, 'DataBits', 8, 'StopBits', 1, 'Parity', 'None');
fopen(S);

Why is this process so slow in Matlab, while it is nearly instantaneous with a simple serial terminal? Is there a better/faster way?

(Since you've not heard back from anyone else...) I can only tell you I don't have anything attached to my serial port, but it took just a second or so for me to run those two lines of code on my machine.

Maybe some other software is communicating with the port? Or you need to update the serial port driver (outside of Matlab) and/or try a different serial card?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM