PLOT ACTION IN TIME LAPS
2 ビュー (過去 30 日間)
古いコメントを表示
hello, i have a dataset with home activities, i need a way to represent the action like in the picture. When the action is running, in this time laps i have 1 as value. when the action isn't running, the time laps represented by 0 as value; but i don't find a solution to rappresent my dataset as in the picture. I've made three different tables where data is organized in different way, tryng to find a solution. Thanks, i'm new in matlab.
0 件のコメント
採用された回答
Duncan Po
2021 年 2 月 18 日
Your data is best represented as a timetable in MATLAB. You can then use stackedplot to generate the visualization.
haa = readtimetable('Home_actionAll.csv');
haa = haa(:,{'Bed_to_Toilet_begin', 'Leave_Home_begin', 'Sleep_begin'}); % the begin variables seem to already capture the information, throw away the rest
haa = varfun(@(x)x>0, haa); % normalize to 0s and 1s
haa.Properties.VariableNames = {'Bed_to_Toilet', 'Leave_Home', 'Sleep'}; % fix the variable names
haa.Properties.VariableContinuity = {'step', 'step', 'step'}; % set continuity such that stairs plots are plotted
sp = stackedplot(haa);
Zooming in shows the stairs better:
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!