How to Determine Column(s) with Most Non-zero values in a matrix?
Show older comments
I have a matrix filled with zeros and ones (a black and white image). Most colums are filled with zeros and I want to find which columns has the most ones in them for position determining. How can I do this efficiently?
Answers (1)
Azzi Abdelmalek
on 30 Jun 2015
Edited: Azzi Abdelmalek
on 30 Jun 2015
A=randi([0 1],8)
[~,idx]=max(sum(A))
Categories
Find more on Creating and Concatenating Matrices 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!