I need to import data from a csv file, which contains hourly temperature data in a year (8760 values ​​in one column), in order to create a 24x365 matrix to make a heatmap like the image

 채택된 답변

Star Strider
Star Strider 2022년 8월 5일

1 개 추천

It looks like a surf plot viewed from the top.
Try this —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1088620/results.csv', 'VariableNamingRule','preserve')
T1 = 8760×2 table
Hour T delivered (C) ____ _______________ 0 56.925 1 56.655 2 56.386 3 56.119 4 55.854 5 55.59 6 55.328 7 55.067 8 16.996 9 16.964 10 20.42 11 27.327 12 48.808 13 61.776 14 66.252 15 65.361
Hours = reshape(T1.Hour, 24, []);
T_del_C = reshape(T1.('T delivered (C)'), 24, []);
xv = datetime(2021,1,0, 'Format','MMM') + days(1:size(T_del_C,2));
yv = Hours(:,1);
figure
surf(xv,yv,T_del_C, 'EdgeColor','none')
colormap(turbo)
view(0,90)
axis('tight')
It comes reasonably close to the plot image in the original post.
Make approopriate changes to get the result you want.
.

댓글 수: 4

Nelson Cardemil
Nelson Cardemil 2022년 8월 5일
In the graph that results from the code, it tells me, for example, that the temperature at hour 0 is 56.92°C, and that is the temperature corresponding to hour 23, so the matrix T_del_C of the code is upside down.
Star Strider
Star Strider 2022년 8월 5일
In that instance, use the flipud function to flip it. (I have no idea what the data are.)
Nelson Cardemil
Nelson Cardemil 2022년 8월 5일
thank you very much, you helped me a lot.
Star Strider
Star Strider 2022년 8월 5일
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2022년 8월 4일

댓글:

2022년 8월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by