change last element in array by specific value matlab

21 vues (au cours des 30 derniers jours)
ha ha
ha ha le 8 Juin 2019
Commenté : ha ha le 8 Juin 2019
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];

Réponse acceptée

madhan ravi
madhan ravi le 8 Juin 2019
Modifié(e) : madhan ravi le 8 Juin 2019
Result = a;
if Result(end) == specific_value % specific value is 9 for example
Result(end) = 1;
end
  4 commentaires
ha ha
ha ha le 8 Juin 2019
Thanks madhan ravi

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by