Element change in a matrix
13 次查看(过去 30 天)
显示 更早的评论
Hello,
I would like to know if its is possible to subtitute elements in a matrix by conditions. Imagine a matrix in where there are number between 1-100, i want to set all value that are under 30 to 0, all between 30 and 75 to 1 and between 75 and 100 to 2, how do i do it? is that even possible? thank you
0 个评论
采纳的回答
KSSV
2021-4-5
编辑:KSSV
2021-4-5
Let A be your matrix.
B = A ;
B(B<30) = 0 ; % replace < 30 to 0
B(B>=30 && B<75) = 1 ;
2 个评论
KSSV
2021-4-5
@Ricardo jose commented:
Uau, it really worked.
Damn im so gratefull, thank a lot, you saved me ahah.
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Choose and Parameterize Blocks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!