change last element in array by specific value matlab
15 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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 个评论
madhan ravi
2019-6-8
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!