TCPIP/Serial Data Live Plot Utility
Live plot utility plots ASCII coded streaming data over tcpip or serial connection.
Demo files are attached for ease of use. Current code should cover a variety of situation. Modify the code to suit your special need.
Data format:
Each line of the streaming data is considered as a sample. The first
column is considered as a label of data. It have to match with a
preset keyword to be considered as a valid sample. The following
columns are numbered 2, 3, 4 .... Data can be extracted from these
columns. For example,
TestPlot 0.001 2.641 231 0
is a sample with keyword TestPlot. The following columns contains 4
numbers that available for plotting.
Usage:
To plot data, issue a command
live_plot(data, conn);
to open up the plot window, where data contains description of data
stream and datasrc contains information about the underlying connection
of data.
data.keyword contains keyword of data to be plotted data.columns
is a vector contain all the columns need to be plot
data.Ts sample time of data, this is used to
recover the real time vector of plot. It is assumed
data comes at a constant frequecy.
data.Twindow set the width of plot window in same unit as Ts.
data.YRange Y direction range. Set to -1 for adaptive.
conn.type Type of connection 'tcpip' or 'serial'
conn.host Remote host name of data, valid for 'tcpip' only.
conn.port Remote tcpip port, or COM port number, in integer.
conn.baud Baudrate of communication, in integer, valid for
'serial' only.
Cite As
Peng Xu (2024). TCPIP/Serial Data Live Plot Utility (https://www.mathworks.com/matlabcentral/fileexchange/46268-tcpip-serial-data-live-plot-utility), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Graphics > 2-D and 3-D Plots > Surfaces, Volumes, and Polygons > Volume Visualization > Vector Volume Data >
Tags
Acknowledgements
Inspired by: Real-Time Auto-Scrolling Graph from Serial Port
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.