skipping elements of a row vector

3 visualizaciones (últimos 30 días)
basma alshaibah
basma alshaibah el 14 de Abr. de 2019
Respondida: madhan ravi el 14 de Abr. de 2019
hello,
i have a row vector of 200 elements and i want to sum the first 10 values, skip the next 10 , then add the third set of 10 and it goes on until i reach the element 200
any idea on how to do that?

Respuestas (1)

madhan ravi
madhan ravi el 14 de Abr. de 2019
idx=reshape(1:200,10,[]); % a is your row vector
sum(a(idx(:,1:2:end)))

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by