How to breakdown a timetable into intervals to performance calculations

2 ビュー (過去 30 日間)
Oliver Higbee
Oliver Higbee 2021 年 9 月 3 日
回答済み: Peter Perkins 2022 年 3 月 2 日
Hi there,
I have a year of data in a timetable, each row of the timetable is a second of data and the output of 48 temperature sensors . I would like to extract a minute of data at a time and perform a modfied Zscore analysis on it to check if there are any outliers. Remove the outliers, then take mean across the columns and build a new timetable of average temperature values.
load('T48ch.mat'); %Load the timetable
t = 60; % time interval to perform analysis over
for i = 1:t:height(T48ch)
%A way to get minute by monute chunks of data
%Zscore analyis
end
This is the code I've written to perform the analysis, I just need to work out a way to add it into the above loop to perform minute by minute analysis
Avs = mean(T48ch{:,:}); % Take average of each channel to get a daily average temperature for each channel
Med1 = median(Avs); % Take median of averages
DiffAvs = abs(Avs - Med1);% Minus the median from the average channel temperature and take the absolute value
Med2 = median(DiffAvs); % Take the median of the absolute value
Zvalue =((0.674*(Avs-Med1))/Med2);% For each Chanel compute =((0.674*(average channel temperature-median))/value calculated in 5) (the single value calculated in 5 is used for all channel temperatures).
TZ = array2table(Zvalue); Names = T48ch.Properties.VariableNames; TZ.Properties.VariableNames = Names;
TvZ = [TZ;T48ch]; %Add into table for comparision
indices = find(abs(TvZ{1,:})>=2);
TvZ(:,indices)= []; % Remove channels with a value greater than 2 as calculated in 6.
TvZ = TvZ(2:end,:); %remove Z value row
Average = mean(TvZ{2:end,:});% Take average of all remaining channels.

回答 (1 件)

Peter Perkins
Peter Perkins 2022 年 3 月 2 日
Oliver, you may have moved on already, but maybe this will still help.
Normally retime would be the thing to use for something "minute by minute". But retime works on one variable at a time, and it sounds like you need to consider all 46 vars at once. I can't follow your intent from your code, but rowfun is your friend, I think.
Add a grouping variable that is a version of the timestamps, discretized to the current minute and apply your function to those groups:
>> tt.Minute = dateshift(tt.Time,'start','minute');
>> rowfun(@yourFunction,tt,"GroupingVariable','Minute','SeparateInputs',false)
That should hand your function a 60x46 numeric matrix. Beyond that, I don't have enough info to go on.

カテゴリ

Help Center および File ExchangePreprocessing Data についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by