0

I have matrix A with size Nx4, and I wanna find minimum pair in 2 and 4-th colomns in this matrix and get the number of this row, how can I do this?

for example:

200000  1,23076923076923    20  1,41538461538462
200000  1,23076923076923    200 1,32307692307692
200000  1,23076923076923    2000    1,32307692307692
200000  1,23076923076923    20000   1,29230769230769
200000  1,23076923076923    200000  1,41538461538462

I need something like this min(A(:, 2), A(:, 4));

answer will be 4th row.

1 Answer 1

0

What is the "minimum pair"?

If it's the pair where both the second and the fourth column are at their lowest, the answer is

minimumRow = find(A(:,2)==min(A(:,2)) & A(:,4) == min(A(:,4)));

If it's the pair with the smallest sum, the answer is

[~,minimumRow] = min(sum(A(:,[2 4]),2));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.