Input Dates from an excel sheet without getting a NaN
Mostrar comentarios más antiguos

Hi there, I would like to input Column A and Plot it against Column F however I get the error message that values must be an integer.
M= readmatrixFilename
Date= M(:,0)
*error*
maxHeight = M(:,4)
Is there a way to inform matlab that M(:,0) is Date/Time data without it spitting out an error and therefore being able to plot the max wave height from 01/04/2021-31/03/2022
Apologies I asked something similar previously as can be seen above.
Thanks in advance
Respuestas (1)
M(:,0) would refer to the 0th column of M, but indexing in MATLAB starts at 1. There is no 0th column, so that's why you get that error message (which specifies positive integer). It's not because of Date/Time data. Try:
Date = M(:,1)
and see what that gives you.
Related:
maxHeight = M(:,5)
2 comentarios
Alfred Cox
el 2 de Mayo de 2022
Voss
el 2 de Mayo de 2022
I would try
Date = datetime(M(:,1))
and use that to plot instead of M(:,1). But the value you report (4.425x10^4) doesn't seem like it would correspond to any date near 31/03/2022, so I don't know for sure.
Maybe upload the file (using the paperclip button) if you continue to have trouble.
Categorías
Más información sobre Time Series Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!