How to find vector in array of vectors with the highest value of one component?

4 次查看(过去 30 天)
I feel like there's an easy solution to this that I'm missing. I have an array of points, p(x,y,z,i), in which the first three components, x, y, and z, are a point in 3d space and the last component, i, is the number assigned to that point. I want to search through the array and find the vector with the highest y-value. How can I do this?

采纳的回答

Matt J
Matt J 2023-4-18
编辑:Matt J 2023-4-18
If I assume that p is an Nx4 array, then,
[~,row]=max(p(:,2));
result=p(row,1:3)
  3 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by