change last element in array by specific value matlab
15 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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];
0 Commenti
Risposta accettata
madhan ravi
il 8 Giu 2019
Modificato: madhan ravi
il 8 Giu 2019
Result = a;
if Result(end) == specific_value % specific value is 9 for example
Result(end) = 1;
end
4 Commenti
madhan ravi
il 8 Giu 2019
Have no idea what you mean doesn’t this work? https://in.mathworks.com/matlabcentral/answers/466110-change-last-element-in-array-by-specific-value-matlab#comment_712854
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!