I have a bit string like bit = [1 1 1 1 1 1 0 1 0 1 0 1 0]
i want to use for to check after the first 7 bits, if it is 1111110, then start to get the signal from the 8th bit, but i dont know how to do that, hope everyone can help me, thanks!

1 件のコメント

Kevin Chng
Kevin Chng 2018 年 10 月 17 日
if strcmp(num2str(bit(1:7)),num2str([1 1 1 1 1 1 0]))
%your code to read 8th bit
bit8 = bit(8);
end

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

回答 (1 件)

Jan
Jan 2018 年 10 月 17 日

0 投票

bit = [1 1 1 1 1 1 0 1 0 1 0 1 0];
if length(bit) >= 7 && isequal(bit(1:7), [1 1 1 1 1 1 0])
signal = bit(8:end);
...
end

カテゴリ

ヘルプ センター および File Exchange で MATLAB についてさらに検索

タグ

質問済み:

2018 年 10 月 17 日

回答済み:

Jan
2018 年 10 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by