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

Jeffrey Clark
Jeffrey Clark 2022년 6월 9일
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.
Jeffrey Clark
Jeffrey Clark 2022년 6월 11일
@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.

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

 채택된 답변

Patrick Baumann
Patrick Baumann 2022년 6월 12일

0 개 추천

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