average values from .cvs file and plot
I want to calculate the hour by hour average values of the FIT column of the attached file, I have tried the following code but I could not solve the problem, then I want to graph the average data vs time
data1 = readtable(‘datos.csv’, ‘VariableNamingRule’,’preserve’);
MyDateTime = data1.Date + data1.Time;
MyDateTime.Format = ‘yyyy-MM-dd HH:mm:ss’;
data2 = [data1(:,1) table(MyDateTime) data1(:,[3:end])];
%%
% Create a new column for the time (round up to the start of the hour)
data.Hour = dateshift(data2.MyDateTime, ‘start’, ‘hour’);
% Group by new time column and calculate average
averageData = groupsummary(data2.MyDateTime, ‘Hour’, ‘mean’, ‘value’);
% Show results
disp(averageData);
% Graph average hourly data
figure;
plot(averageData.Hour, averageData.mean_value, ‘-o’);
xlabel(‘Date & Time’);
ylabel(‘Average value Pressure’);
title(‘Average Hour by Hour’);
grid on;
% Save results to a new CSV file
writetable(averageData, ‘promedios_hora_a_hora.csv’)I want to calculate the hour by hour average values of the FIT column of the attached file, I have tried the following code but I could not solve the problem, then I want to graph the average data vs time
data1 = readtable(‘datos.csv’, ‘VariableNamingRule’,’preserve’);
MyDateTime = data1.Date + data1.Time;
MyDateTime.Format = ‘yyyy-MM-dd HH:mm:ss’;
data2 = [data1(:,1) table(MyDateTime) data1(:,[3:end])];
%%
% Create a new column for the time (round up to the start of the hour)
data.Hour = dateshift(data2.MyDateTime, ‘start’, ‘hour’);
% Group by new time column and calculate average
averageData = groupsummary(data2.MyDateTime, ‘Hour’, ‘mean’, ‘value’);
% Show results
disp(averageData);
% Graph average hourly data
figure;
plot(averageData.Hour, averageData.mean_value, ‘-o’);
xlabel(‘Date & Time’);
ylabel(‘Average value Pressure’);
title(‘Average Hour by Hour’);
grid on;
% Save results to a new CSV file
writetable(averageData, ‘promedios_hora_a_hora.csv’) I want to calculate the hour by hour average values of the FIT column of the attached file, I have tried the following code but I could not solve the problem, then I want to graph the average data vs time
data1 = readtable(‘datos.csv’, ‘VariableNamingRule’,’preserve’);
MyDateTime = data1.Date + data1.Time;
MyDateTime.Format = ‘yyyy-MM-dd HH:mm:ss’;
data2 = [data1(:,1) table(MyDateTime) data1(:,[3:end])];
%%
% Create a new column for the time (round up to the start of the hour)
data.Hour = dateshift(data2.MyDateTime, ‘start’, ‘hour’);
% Group by new time column and calculate average
averageData = groupsummary(data2.MyDateTime, ‘Hour’, ‘mean’, ‘value’);
% Show results
disp(averageData);
% Graph average hourly data
figure;
plot(averageData.Hour, averageData.mean_value, ‘-o’);
xlabel(‘Date & Time’);
ylabel(‘Average value Pressure’);
title(‘Average Hour by Hour’);
grid on;
% Save results to a new CSV file
writetable(averageData, ‘promedios_hora_a_hora.csv’) average data MATLAB Answers — New Questions