finding the maximum of values after and before a specific value
1 次查看(过去 30 天)
显示 更早的评论
hello, I have a doubt.Is it possible to find out the maximum values before and after the ith element in an array?
2 个评论
采纳的回答
Birdman
2017-12-19
One approach:
a=randi([1 10],1,10);
ind=4;%4th element in a vector is chosen
a1=a(1:ind-1);
a2=a(ind+1,end);
max(a1)
max(a2)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!