plotting temperature contour from a string of temperature values/data into matlab
1 view (last 30 days)
Show older comments
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
Answers (2)
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
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.
See Also
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!