Borrar filtros
Borrar filtros

how to add 2 to some of array's elements?

14 visualizaciones (últimos 30 días)
zeezo
zeezo el 19 de Mzo. de 2018
Comentada: zeezo el 19 de Mzo. de 2018
I have this array and I would like to add 2 to the elements starting from the third one
a=[1;6;9;8;3;6;8;2;1;5;4;7;6;99;5;4]
so I want to add 2 to 9,8 and 3 up to the end only.

Respuesta aceptada

James Tursa
James Tursa el 19 de Mzo. de 2018
Editada: James Tursa el 19 de Mzo. de 2018
a(3:end) = a(3:end) + 2;

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by