Find rows with maximum number and replace them with 1
1 view (last 30 days)
Show older comments
Maryam Hamrahi
on 8 Aug 2016
Commented: Maryam Hamrahi
on 8 Aug 2016
I have a matrix with n rows and 1 column. I would like to find row which have the maximum number. Then, replace 1 in these rows and replace 0 in other rows.
For instance: I have matrix A and I would like to produce matrix B.
A=
5
0
0
4
3
0
B=
0
1
1
0
0
1
0 Comments
Accepted Answer
More Answers (2)
See Also
Categories
Find more on Logical 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!