Binary value convert.

5 ビュー (過去 30 日間)
Noman Abir
Noman Abir 2021 年 1 月 2 日
コメント済み: Ameer Hamza 2021 年 1 月 2 日
I have a binary bit sequence A = [0 1 0 1;1 0 0 1; 0 0 0 1; 1 0 0 1]; How can i convert all the 0 values into -1.??
The final output will become as A = [-1 1 -1 1;1 -1 -1 1;-1 -1 -1 1;1 -1 -1 1];

採用された回答

Ameer Hamza
Ameer Hamza 2021 年 1 月 2 日
Read about logical indexing
A = [0 1 0 1;1 0 0 1; 0 0 0 1; 1 0 0 1];
A(A==0) = -1;
  3 件のコメント
Ameer Hamza
Ameer Hamza 2021 年 1 月 2 日
Yes, it is better to post your question on this forum so that you have a better chance of getting any help, and the answers will also be helpful for others.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeVideo games についてさらに検索

タグ

製品


リリース

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by