Average numbers in array
1 view (last 30 days)
Show older comments
Hello,
I've got an array with 65926x2 values. I try to make average when the 1st column got numer of 600 and write in the a new array as 1st cell. Then i want a next average till the numer of 1st column is 1200. What i mean is the time_space_average=[0:600:604800];
So at the end i want to have an array with 1009x1 elements. i will put excel table and picture of the data arrays!
Thanks in advance!
0 Comments
Answers (1)
KSSV
on 4 Aug 2021
You may proceed some like this shown below:
T = readtable('C:\Users\KSSV\Downloads\1.xlsx') ;
x = T.(1) ; y = T.(2) ;
idx = 0:600:604800;
[c,ia] = ismember(idx,x) ;
n = length(ia);
iwant = zeros(n-1,2) ;
for i = 1:n-1
iwant(i,:) = [idx(i) mean(y(i:i+1))] ;
end
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!