Heatmap plot temperature vs time

조회 수: 11 (최근 30일)
Laura Guarino
Laura Guarino 2022년 8월 28일
댓글: Walter Roberson 2022년 8월 28일
I need to create a heatmap showing the temperature trend as a function of time acquired from ten sensors equally spaced. I have tried to plot it starting from a two columns matrix where the first one is a vector relevant to time while the second one is the corresponding temperature. I have tried with the following code:
heatmap(tbl,'time','temperature','Colormap',redbluecmap);
However, it shows me this error message: The name 'time' is not an accessible property for an instance of class 'matlab.graphics.chart.HeatmapChart'.
How can I fix it?
I should obtain something similar to this:
  댓글 수: 1
Walter Roberson
Walter Roberson 2022년 8월 28일
What shows up for
class(tbl)
tbl.Properties.VariableNames

댓글을 달려면 로그인하십시오.

채택된 답변

Abderrahim. B
Abderrahim. B 2022년 8월 28일
Hi!
I know what is the issue. You have a timetable not a table and the first column related to time is not considered as variable . Solution: Convert to table
Demo below:
clear
MeasurementTime = datetime({'2015-12-18 08:03:05';'2015-12-18 10:03:17';'2015-12-18 12:03:13'});
Temp = [37.3;39.1;42.3];
Pressure = [30.1;30.03;29.9];
WindSpeed = [13.4;6.5;7.3];
TT = timetable(MeasurementTime,Temp,Pressure,WindSpeed)
TT = 3×3 timetable
MeasurementTime Temp Pressure WindSpeed ____________________ ____ ________ _________ 18-Dec-2015 08:03:05 37.3 30.1 13.4 18-Dec-2015 10:03:17 39.1 30.03 6.5 18-Dec-2015 12:03:13 42.3 29.9 7.3
TT = timetable2table(TT) ;
heatmap(TT, "MeasurementTime", "Temp")
  댓글 수: 3
Abderrahim. B
Abderrahim. B 2022년 8월 28일
You are right.I did not read carefully the question. Need to edit or remove this answer. Thanks Walter.
Walter Roberson
Walter Roberson 2022년 8월 28일
The error they received would be consistent with the possibility that they had previously done
tbl = heatmap(...)
and are now trying to do
heatmap(tbl, ...)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by