フィルターのクリア

Using logical operator and maintaining array size

1 回表示 (過去 30 日間)
SJ Won
SJ Won 2019 年 7 月 4 日
コメント済み: SJ Won 2019 年 7 月 4 日
Say I have x = [ 0 0 1 1 1] and y = [ 4 3 6 6 8]
How do I use logical operator so that I maintain the array size? I want the result to say [ 0 0 6 6 8] - so if it's false then make them zero but keep the rest. I'm trying to avoid if or for loops if possible.

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 7 月 4 日
編集済み: KALYAN ACHARJYA 2019 年 7 月 4 日
Why logical? its simple multiplication.
>> x.*y
ans =
0 0 6 6 8
  2 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 7 月 4 日
OK?
SJ Won
SJ Won 2019 年 7 月 4 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by