change last element in array by specific value matlab

21 ビュー (過去 30 日間)
ha ha
ha ha 2019 年 6 月 8 日
コメント済み: ha ha 2019 年 6 月 8 日
Let's say I have matrix a
a=[1 2 3 4 5 6 7 8 9];
it's observed that the last value of array a is "9".
I want to change this value to be 1
Hope result is:
reslut=[1 2 3 4 5 6 7 8 1];

採用された回答

madhan ravi
madhan ravi 2019 年 6 月 8 日
編集済み: madhan ravi 2019 年 6 月 8 日
Result = a;
if Result(end) == specific_value % specific value is 9 for example
Result(end) = 1;
end
  4 件のコメント
ha ha
ha ha 2019 年 6 月 8 日
Thanks madhan ravi

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

その他の回答 (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