Stream Data from serial port device to screen

8 次查看(过去 30 天)
I have a serial device, that turns up on COM6. It i sending data continuously to an app, it sends in groups of 4 comma separated values. (with the potential for non-conformal data-points as interupts- e.g. start/stop.)
what i would like to do is stream this directly to the app screen as either a plot of 4 lines, or 4 gauges or four boxes with numbers in, not really too bothered about the format on screen as long as its readable, i would obviously also like to store said data as it comes in.
I was looking for some poitners on how to do this, but using searches didn't find anything useful in the answered questions here.
Thanks
JR
p.s. i have base matlab and instrument control, if i need other toolboxes to enable this please advise

回答(1 个)

Nitin Kapgate
Nitin Kapgate 2020-10-28
You can refer the guide about Serial Port Devices to learn about communicating between two MATLAB and devices connected to a serial port.
The communication through a serial port is established with a serialport object created in the MATLAB workspace.
Before you can write or read data, the serialport object and the instrument must have identical communication settings. You can refer the documentation to Configure Serial Port Communication Settings.
You can get this functionality in the base MATLAB itself, so no other additional toolbox is needed.

Community Treasure Hunt

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

Start Hunting!

Translated by