Use element values for IF statements
1 次查看(过去 30 天)
显示 更早的评论
Hi all,
I would like to use the value of the elements in matrix B as condition for changing the values in matrix A. Note that Both A & B have the same size. For example, let A = [1 1;1 1] and B = [120 50; 75 175]. If the values of any element in B is greater than 100, I would like to change the values of the element in its corresponding position in A to zero(0). So the new matrix A for this example would be A = [0 1; 1 0]. Please how can I code this? Thanks in advance.
OlFat
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!