Code covered by the BSD License  

Highlights from
Real time Data plot from serial port


4.0 | 4 ratings Rate this file 288 Downloads (last 30 days) File Size: 1.99 KB File ID: #28941
image thumbnail

Real time Data plot from serial port



It plots real time data from serial port. It can use for any serial port device.

| Watch this File

File Information

real time data plot from a serial port
This matlab script is for plotting a graph by accessing serial port data in real time. Change the com values and all variable values accroding to your requirements. Do not forget to add terminator in to your serial device program.

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
16 Feb 2014 warut Phothiphan  
10 Aug 2013 antonydublin

Recently I’ve found this script «Real time Data plot from serial port» back from 2010 on MathWorks blogs. Just want to say thanks, it is simple and helpful example. In other words, this not sophisticated code easy to understand and change in any way. To Dimit: you must add terminator (0x0D, 0x0A) after each value of data in your transmission, in basic terminal programs this means to turn on «Send line feeds with carriage return» (or CR=CR+LF). Also could be helpful any “Virtual Serial Port” while debugging without external device.

10 Aug 2013 antonydublin  
16 Jun 2013 dimit


When I run this code I get the following error. What should I do ?

??? In an assignment A(I) = B, the number of elements in B and
I must be the same.

Error in ==> real_time_data_serial at 80
voltage(count) = fscanf(s,'%f');

10 Dec 2012 farrukh sabir

wow! it works perfect. thanks a lot. i just set com port number and sent serial data via PIC mcu and it worked fine for me.
have a look at my post

thanks again Moidu Thavot

04 Oct 2010 Sean de

This really should be a function with everything that needs to be changed as input variables. It could then have defaults if the variables aren't entered. The author should also take heed to MLINT.

Contact us