Checking a 1x24 Array for numbers less than 0
1 次查看(过去 30 天)
显示 更早的评论
I need assistance with changing a number less than 0 in an array to 0. I attempted to program this but I am lost. Any help would be appreciated.
0 个评论
采纳的回答
Changoleon
2016-11-16
编辑:Changoleon
2016-11-16
for example if a is the matrix
a = [ 0 2 1 -9 -8 6 100 -63 1 2 5];
you can do following
a(a<0)=0;
Now a has just the values equal or greater than zero
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!