Binary value conversion.

1 回表示 (過去 30 日間)
Noman Abir
Noman Abir 2021 年 1 月 2 日
コメント済み: Noman Abir 2021 年 1 月 5 日
I have a binary sequence like this :
01011001
01010110
01010010
01001111
01001100
01010010
01011001
How can I convert all the 0 values to -1..? 1 values will be 1 as well.
  2 件のコメント
John D'Errico
John D'Errico 2021 年 1 月 2 日
Please. There was no reason to ask the same question twice.
Noman Abir
Noman Abir 2021 年 1 月 2 日
The network issue. That's why it submitted twice. sorry.

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

採用された回答

Image Analyst
Image Analyst 2021 年 1 月 2 日
mask = yourSequence == 0; % Find all 0s
yourSequence(mask) = -1; % Convert 0s to -1s.
  25 件のコメント
Noman Abir
Noman Abir 2021 年 1 月 4 日
Thank you. I have got my solution.
Noman Abir
Noman Abir 2021 年 1 月 5 日
I need some more help from you @Walter Roberson & @Image Analyst.
I have added 2 different MATLAB files where "receive_cdm.m" is my main code and "y_send.mat" is a file I am getting some values from it and loaded it in main code section.
If you look at the code then I have assigned 1 parameter c1. Forget about other parameters.
The following tasks are explained in the code.
I have done it with proper MATLAB commands and equations.
But, I am getting error when I calculate it manually and matching it with MATLAB calculations. (What I should get and what I am getting from MATLAB)
Can anyone check my code, please..?
It would be very helpful for me.

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 1 月 2 日
num = (z-'0')*2-1;

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

製品


リリース

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by