What does a(a<0) = 0 mean in matlab?
Show older comments
I am new to matlab.
What does a(a<0) = 0 mean?
is it valid if a is an array as well?
Accepted Answer
More Answers (1)
> What does a(a<0) = 0 mean?
a can be a scalar or an array.
This replaces all values in a that are less than 0 with 0.
Example
a = [-6: 2 : 6]
a(a<0) = 0
Categories
Find more on Matrices and Arrays 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!