Contour Plot Date/Depth/Temperature

I am trying to create a Contour Plot containing the values: Date/Waterdepth/Temperature. The table looks like that in Excel, were blue=depth, orange=dates and green=temperature:
Here is my code and the error I receive:
data = readtable('temperatur.xls','Range','A1:H21');
x = data(2:end,1);
y = data(1,2:end);
z = data(2:end,2:end);
contourf(x, y, z);
It appears to me that Matlab has an issue with the date-time format. I have tried to use numerous different date formats but could not get it to work. The XLS file is attached to this question. Any help is very much appreciated!

댓글 수: 2

Dennis Mayk
Dennis Mayk 2018년 5월 19일
편집: Dennis Mayk 2018년 5월 19일
Okay, so I figured out how to solve this and just want to share it here if somebody else faces the same problem. The the problem seemed to be the formatting of my excel dates: DD.MM.YYYY when I changed these to the format MM.DD.YYYY I could use the datenum(t) function to transfer the dates to matlab dates and contourf worked like a charm.
Ruben
Ruben 2022년 7월 15일
Hello, I am trying to do the exact same thing however my datetime values are in MM/DD/YY HH:MM:SS since I have data for every 5 minutes. I get the same exact issues, except datenum just fails outright. Any suggestions?

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

답변 (0개)

카테고리

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

제품

질문:

2018년 5월 18일

댓글:

2022년 7월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by