Serial vs. Serialport questions
4 views (last 30 days)
Show older comments
I had a few questions about differences between the legacy serial objects and the newer serialport implementation. Any help would be quite welcome:
What is the expected time-frame for retiring the serial interface?
We have a substantial codebase using the legacy serial classes and I'm wondering about the time frame for moving to serialport.
What advantages does serialport offer?
Despite the documentation of API differences there seems to be very little information about the actual functional differences between serial and serialport. Are there substantive differences between the two? Have there been any official statements explaining why the old interface is being deprecated?
What about lost functionality?
One particular difference that seems problematic is that there seems no way to close a serialport objects. There are a number of Answers claiming that you can just delete the serialport, but this far from equivalent functionality. It's pretty common for us to close the serial object in Matlab, access the same com-port temporarily in another application for specialized tasks, and then reopen the port in Matlab. It has been quite useful to store information in the serial.UserData struct and if we are forced to delete the serialport object and recreate it, there is significant overhead to cache the UserData somewhere and then reconfigure the port when we want to use it again.
2 Comments
Connor Olsen
on 26 Oct 2021
I would also love to know the answers to these questions. Swapping to the new serialport class has fixed one issue in my code, but the lack of way to close the object has been very anoying. Additionally, the new class I've built around the serialport object seems to take longer than the code using serial did.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!