Reputation: 3199
I need to replace several occurences of a number (5) in the first column of my matrix for -1. How can I do it?
Upvotes: 1
Views: 2580
Reputation: 9313
Try this:
A(A(:,1)==5,1) = -1
Hope this helps.
Upvotes: 10