How to replace multiple elemets at particular index in vector ?

24 ビュー (過去 30 日間)
Ole
Ole 2020 年 8 月 6 日
コメント済み: Ole 2020 年 8 月 6 日
How to replace multiple elements in particular position inside a vector ?
a = [1 2 3 4 5 6 7 8 9]
% I would like to replace values at index position 3 5 7 to value 0.7 0.1 0.9
% in single operation if possible
a(3) = 0.7;
a(5) = 0.1;
a(7) = 0.9;
a

採用された回答

madhan ravi
madhan ravi 2020 年 8 月 6 日
編集済み: madhan ravi 2020 年 8 月 6 日
a(3 : 2 : 7) = [.7, .1, .9]

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by