min value of each row with corresponding column

2 views (last 30 days)
How to do the following?
If there are three columns and I want to get the min value of each row and I want to know from which column was this value

Accepted Answer

Dyuman Joshi
Dyuman Joshi on 1 Nov 2023
y = magic(3)
y = 3×3
8 1 6 3 5 7 4 9 2
%Utilize the functionality of min()
[m,idx] = min(y, [], 2)
m = 3×1
1 3 2
idx = 3×1
2 1 3

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!