Not getting proper time series plot

1 Ansicht (letzte 30 Tage)
Nathaniel Porter
Nathaniel Porter am 19 Dez. 2021
Kommentiert: Nathaniel Porter am 19 Dez. 2021
The csv file is left in a table format, then A2:D60 is selected for day 1 and then imported. This set if data is then named glucose1_1. For some reason not getting a good time series plot.
%patient 1 Day 1
%Formatting the date with time
glucose1_1.date.Format = 'dd.MM.uuuu HH:mm';
glucose1_1.time.Format = 'hh:mm:ss.S';
%Adding the date with time to the first column
glucose1_1.date = [glucose1_1.date glucose1_1.time];
%Changing glucose values from mmol/L to mg/dL by multiplying 18
glucose1_1.glucose = glucose1_1.glucose*18;
%plotting 3-5 cycles of glucose data over 6 days
plot(glucose1_1.date,glucose1_1.glucose);
grid on; legend('Patient1, Day1');
xlabel('Date and Time'); ylabel('Serum Glucose Level (mg/dl)');
hold on;
M1 = mean(glucose1_1.glucose)
S1 = std(glucose1_1.glucose)

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 19 Dez. 2021
We do not know what you expect the plot to look like?
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/838655/glucose.csv';
glucose1_1 = readtable(filename, 'Range', 'A1:D60');
%patient 1 Day 1
%Formatting the date with time
glucose1_1.date.Format = 'dd.MM.uuuu HH:mm';
glucose1_1.time.Format = 'hh:mm:ss.S';
%Adding the date with time to the first column
glucose1_1.date = glucose1_1.date + glucose1_1.time;
%Changing glucose values from mmol/L to mg/dL by multiplying 18
glucose1_1.glucose = glucose1_1.glucose*18;
%plotting 3-5 cycles of glucose data over 6 days
plot(glucose1_1.date,glucose1_1.glucose);
grid on; legend('Patient1, Day1');
xlabel('Date and Time'); ylabel('Serum Glucose Level (mg/dl)');
hold on;
M1 = mean(glucose1_1.glucose)
M1 = 157.3017
S1 = std(glucose1_1.glucose)
S1 = 19.0553
  2 Kommentare
Nathaniel Porter
Nathaniel Porter am 19 Dez. 2021
Okay yes something like that
Nathaniel Porter
Nathaniel Porter am 19 Dez. 2021
Thank you

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by