フィルターのクリア

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

14 ビュー (過去 30 日間)
zeezo
zeezo 2018 年 3 月 19 日
コメント済み: zeezo 2018 年 3 月 19 日
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.

採用された回答

James Tursa
James Tursa 2018 年 3 月 19 日
編集済み: James Tursa 2018 年 3 月 19 日
a(3:end) = a(3:end) + 2;
  1 件のコメント
zeezo
zeezo 2018 年 3 月 19 日
thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by