Plot binary sequence of type char (MATLAB)
古いコメントを表示
Dear,
I have this binary sequence '011010001000000001010011' of type char, and I want to plot it to obtain a graph like that for example:

2 件のコメント
Fifteen12
2022 年 12 月 2 日
What have you tried so far? Love to help, but not sure what you're confused on!
high speed
2022 年 12 月 2 日
採用された回答
その他の回答 (1 件)
seq = randi(2, [1, 20]) - 1;
y = seq(1);
x = 0;
for i = 1:length(seq)-1
y(end+1) = seq(i);
x(end+1) = i;
if seq(i+1) ~= seq(i)
y(end+1) = seq(i+1);
x(end+1) = i;
end
end
plot(x, y)
axis([0, x(end), -2, 3])
カテゴリ
ヘルプ センター および File Exchange で Descriptive Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

