Filtering the data according to the time stamp
2 views (last 30 days)
Show older comments
I would like to filter this data according to the time stamp i.e for the first three second of the time, and take average of Elevation and Speed at 0, 1, 2 and 3 sec.
OR take average for the first three second each time, and return one mean value for each parameters.
What is the appropriate function?
Anyone expert on this?
Let say matrix of A =
Time, s Elevation Speed
0 23.9 0.28
0 23.9 0.28
0 23.9 0.28
0 23.9 0.28
1 23.9 0.28
1 23.9 0.28
1 24.7 0.28
1 24.7 0.28
1 24.7 0.28
1 24.7 0.28
2 24.7 0.28
2 24.7 0.28
2 24.7 0.44
2 24.7 0.44
3 23.1 0.44
3 23.1 0.44
3 23.1 0.44
3 23.1 0.44
3 23.1 0.44
3 23.1 0.44
0 Comments
Answers (1)
Kostas
on 20 Nov 2011
Sure not the most "efficient" solution but could work smt like that
k=0;
for i=0:3 % loop over the seconds
id=find(A(:,1)==i); %get indices where you find the time you want
if ~isempty(id)
k=k+1;
elev_mean=mean(A(id,2)); %mean value of parameter elevation
s_mean=mean(A(id,3)); %mean value of parameter time
m_values(k,:)=[i elev_mean s_mean];
end
end
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!