I have a array of 61 number, i want to take mean of 1st and 17th number, then 2nd and 18th number and then want to put this mean values in a array?

2 views (last 30 days)
Subhodh Sharma
Subhodh Sharma on 29 Jul 2021
Commented: Subhodh Sharma on 29 Jul 2021
I don't want to use loop here.

Answers (1)

KSSV on 29 Jul 2021
A = rand(1,61) ;
idx = [(1:46)' (16:61)'] ; % get indices
iwant = mean(A(idx),2)

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!

Translated by