Sum of specific elements in a column matrix

Say I have a column matrix [1;2;3;4;5;6;7;8;9]. I want to add the elements from row 3 to row 9.
So the result will come as 42

 Respuesta aceptada

madhan ravi
madhan ravi el 3 de Dic. de 2018
Editada: madhan ravi el 3 de Dic. de 2018
a=[1;2;3;4;5;6;7;8;9];
sum(a(3:size(a,1))) % size(a,1) can be whichever element you wish
command window:
ans =
42

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 3 de Dic. de 2018

Editada:

el 3 de Dic. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by