Plotting date time Hear rate and Stress in the same plot and/or in different plots

3 views (last 30 days)
Hi htere,
i have a CSV file (containing Date, Sleep Time, Heart Rate and Stress data) which I am attaching as well. I want to plot date on the x-axis (all dates with only one day iteration),
then I want to see how much the person slept each day?
How much was his Hear Rate every day?
How much was the Stress Level every day?
i am totally new to the MATLAB so don't know much differences between tableread and csv read plus a newbie on syntax as well. Struggling a lot. Also, if someone could kindly help what other patterns can be made/obtained using this data would be great!
Many thanks in advance!

Accepted Answer

Peter Perkins
Peter Perkins on 4 Jun 2019
After a bit of cleaning up, I get this timetable:
>> TT = readtimetable('SHS.csv');
>> TT.Time.Format = "dd-MMM-yyyy";
>> TT.Var3 = duration(TT.Var3,"Format","hh:mm");
>> TT = TT(:,3:5);
>> TT.Properties.VariableNames = ["SleepTime" "HeartRate" "Stress"]
TT =
84×3 timetable
Time SleepTime HeartRate Stress
___________ _________ _________ ______
21-Feb-2019 09:00 60 41
22-Feb-2019 06:09 68 34
23-Feb-2019 09:18 61 14
24-Feb-2019 08:00 63 24
25-Feb-2019 07:30 67 26
26-Feb-2019 07:04 66 20
[snip]
Plotting is easy, perhaps this:
>> plot(TT.Time,TT.SleepTime)
untitled1.png
or perhaps this:
>> stackedplot(TT)
untitled2.png
  2 Comments
Zaffar Mughal
Zaffar Mughal on 4 Jun 2019
Ah Many thanks! You are great! Could you please help me with some feature extraction, e.g. if I want to see my HEART RATE/Stress Level/SLEEP TIMING during the weekdays and weekend? Do you have any other features we can extract from this tiny data set? Its only one person data so the age,sex,ethnicity features can't be added up. BUT if you have anyother features in mind plz plz plz let me know and also weekend vs weekend visualization. Also, after the features extraction I want to carry on PCA and Clustering. i shall be and am grateful to you for this favor. YOU ARE A SUPERSTAR SIR! MUCH MUCH MUCH APPRECIATED.

Sign in to comment.

More Answers (0)

Categories

Find more on Stress and Strain in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!