changing the structure of a matrix according to a characteristic matrix

1 回表示 (過去 30 日間)
Tilek Zhumabek
Tilek Zhumabek 2020 年 10 月 21 日
編集済み: Sudhakar Shinde 2020 年 10 月 22 日
I have a matrix (I am calling it characteristic):
=
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 .
=
0 8 7
0 0 7
4 5 3
Any idea how to do it?

採用された回答

Sudhakar Shinde
Sudhakar Shinde 2020 年 10 月 22 日
編集済み: Sudhakar Shinde 2020 年 10 月 22 日
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 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by