Borrar filtros
Borrar filtros

Not getting proper time series plot

1 visualización (últimos 30 días)
Nathaniel Porter
Nathaniel Porter el 19 de Dic. de 2021
Comentada: Nathaniel Porter el 19 de Dic. de 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)

Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Dic. de 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 comentarios
Nathaniel Porter
Nathaniel Porter el 19 de Dic. de 2021
Okay yes something like that
Nathaniel Porter
Nathaniel Porter el 19 de Dic. de 2021
Thank you

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by