changing the structure of a matrix according to a characteristic matrix
1 view (last 30 days)
Show older comments
Tilek Zhumabek
on 21 Oct 2020
Edited: Sudhakar Shinde
on 22 Oct 2020
I have a matrix (I am calling it characteristic):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/387808/image.png)
0 1 1
0 0 1
1 1 1
and another one (which has to be changed):
b =
9 8 7
3 2 7
4 5 3
What I want is to make certain operation on b to remove elements that are in the position of 0 in matrix
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/387813/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/387818/image.png)
0 8 7
0 0 7
4 5 3
Any idea how to do it?
0 Comments
Accepted Answer
Sudhakar Shinde
on 22 Oct 2020
Edited: Sudhakar Shinde
on 22 Oct 2020
Use elementwise (.) operator :
Xa=[0 1 1;0 0 1;1 1 1]
b=[9 8 7;3 2 7;4 5 3]
b.*Xa
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!