How to plot each row of a MxN array as one value

조회 수: 1 (최근 30일)
Cristine  Sev
Cristine Sev 2022년 6월 4일
편집: dpb 2022년 6월 6일
Hello guys, so here is the thing,i have an array lets say Z (Mx3). Its row is the encoded binary form of a sampled and quantized signal...what i want to do is plot Z and in Y-axis i want to display the binary code from each row...lets say z = [0 0 1;0 1 0;1 0 1;1 0 1;1 1 1;0 0 0]...so i want to plot it and Y-axis should start from 0 0 0 then next level should be 0 0 1 till 1 1 1...in the photo is an example of what i want

채택된 답변

dpb
dpb 2022년 6월 4일
편집: dpb 2022년 6월 6일
Looks like
hL=stairs(z*2.^(2:-1:0).');
yticks([0:2:6])
yticklabels(dec2bin(yticks,3))
otta' do it...
That plots against ordinal position on x axis; looks like the original was plotted against
N=size(z,1);
hL=stairs([1:N]/N,z*2.^(2:-1:0).');
to get the range from 0-1

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by