3D plot Datetime Data daywise

I have data recorded over several days with datetime format. Those are not continious recordings, only on a event the data is recorded for several seconds with a resolution of 10 Hz.
What i want is to plot those recodings in a 3D plot, x-Axis seconds of a day, y-axis the value of the recording and on the z-axis the different days, with to goal to see if the patterns are occuring around the same time during the days.
I fail at creating arrays / or matrices with matching dimensions, since the recordings are not deterministic. I was thinking about creating a "index column" from 0 to 86400000 for milisecons of a whole day and similar to excel combine the data with a "vlookup" function. But then i'll end up with out of memory problems.
Is there a better way to do this?

3 个评论

Create a table, matrix or separate vectors with one row for each measurement (and a column if a table or matrix) of x (time of day), y (event data) any z (day number). Use plot3(x,y,z,'ko') or similar to create the plot.
@Patrick Baumann if you are having a problem spliting your datetime into the time (x) and day(z) see Dates and Time - MATLAB & Simulink (mathworks.com)
This relatively new syntax
[TOD,DATE] = timeofday(DT) also returns an array of datetimes equal to the date
portion of DT, i.e. DATESHIFT(DT,'start','day').
So, given a timetable tt:
[tt.ToD,tt.Date] = timeofday(tt.TimeStamp);
is especially useful for splitting into ToD and date. Depending on what kind of plot you want, plot3 using tt.ToD, tt.Date, and tt.Value might be all you need, or you might need to loop over days and plot each subset separately.

请先登录,再进行评论。

 采纳的回答

Thanks, i think i found a solution:
I am using plot3, so for the z-axis i take second of day sexond(blabla.time, 'secondofday'), for x-axis the actual measurement and for y-axis day of year day(blabla.time, 'dayofyear')
So in the end i have something like:
plot3(second(bla.time, 'secondofday'), bla.measurement, day(bla.time, 'dayofyear'));
I don't need to do any padding or combine different days of measurement, i can take the whole datastream (datetime + measurement) in one take to make a nice 3D plot to see patterns over the time of a day for several days.

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Dates and Time 的更多信息

产品

版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by