help how can I find the minimum number and return it's index in each row?
显示 更早的评论
help how can I find the minimum number and return it's index in each row?
采纳的回答
更多回答(1 个)
Guillaume
2014-11-13
To find the minimum of a row, use:
min(m, [], 2)
Probably, the simplest way to ignore 0s is to replace them with NaNs before calling min.
m(m == 0) = nan;
[mval, mcol] = min(m, [], 2);
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!