plotting temperature contour from a string of temperature values/data into matlab

1 view (last 30 days)
After I have received a string of data from a temperature sensor, how am I going to input with my temperature readings onto the matlab? The temperature readings have (eg: 230 which means it is 23 degree Celsius and so on...) 16 different values from a 4x4 grid. Next, I am suppose to "implant" these values and plot a temperature contour.
Is it the same method as using txt file?
I need a brief start so as to continue from there. Thank you.
  5 Comments
Teo Shi Wei
Teo Shi Wei on 8 Feb 2014
It is connected to my laptop and "make all" or runs the program through programmer notepad and then reads the values from RealTerm.

Sign in to comment.

Answers (2)

Walter Roberson
Walter Roberson on 8 Feb 2014
Use the serial() function with 57600 baud to connect to the laptop. You can likely use fscanf() to read values from the device. You can set up BytesAvailableFcn callbacks at the serial() level to deal with data as it comes in. You would need to find out what line terminator is used between samples.
Example routines:
The second of those uses TCP but the setting of callbacks is the same for serial and TCP (with the exception that TCP has a "packet termination mode" setting.)
  3 Comments
Teo Shi Wei
Teo Shi Wei on 9 Feb 2014
I don't quite understand from the real time data plot. I just want to have a txt file, so that I can read from the txt file to input on matlab to show the temperature contour. Is it necessary to do that?
I'm sorry, I am not very good in matlab and stuff so I need to get clear of that first. Thanks for the help!
Walter Roberson
Walter Roberson on 10 Feb 2014
Certainly you can write to a file and plot later instead of plotting in real time. In terms of the code for the second File Exchange contribution #27290, the function localReadAndPlot would be changed slightly to write the data to a file instead of set()'ing a handle's YData parameter. You can use fprintf() to write data to a file.

Sign in to comment.


Teo Shi Wei
Teo Shi Wei on 11 Feb 2014
I can't find this as I was following the 2nd link you gave. From "Control Panel > Add Remove Programs > Add/Remove Windows Component > Networking Services"
I was thinking to use excel file but I am uncertain how to use it. I can't get the 4x4 temperature reading as well.

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!