final result depending on the consistency of ones and zeros

1 回表示 (過去 30 日間)
Ayesha Punjabi
Ayesha Punjabi 2018 年 10 月 19 日
コメント済み: Rik 2018 年 10 月 23 日
  • I have 2 results results of out0 has [1111000011110000] and out1 has [1111111111111111] (total 16 bits) how would I predict that final data value from out 1 is 1 since it has more number of 1 (i.e if the consistency of 1 is more the final result is 1) and final data value as 0 if its inconsistent just like out0
  4 件のコメント
Rik
Rik 2018 年 10 月 20 日
So your question is how to find out if a vector of 16 values has a majority of ones?
Ayesha Punjabi
Ayesha Punjabi 2018 年 10 月 20 日
yes

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

回答 (1 件)

Rik
Rik 2018 年 10 月 20 日
out0 = [1111000011110000]
out1 = [1111111111111111]
convert_to_1_bit=@(vector) mean(vector)>0.5;
convert_to_1_bit(out0)%should return false (0)
convert_to_1_bit(out1)%should return true (1)
  1 件のコメント
Rik
Rik 2018 年 10 月 23 日
if you found this answer useful, please mark it as accepted answer. It will give me reputation points and will make it easier for other people with the same question to find an answer.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by