1

Suppose I have a 2D array like this :

Array = [1 2 3; 5 1 6; 4 3 2]

I want to find the minimum value between each row, and save the column index of that result. I want my answer's like this :

ans = [1; 1; 2]

and the index :

column_index = [1; 2; 3]

Can somebody please help me? Thank you.

0

1 Answer 1

2

You are looking to find the minimum values along the second dimension. Use min -

[minval,column_index] = min(Array,[],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.