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

2 views (last 30 days)
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

Accepted Answer

dpb
dpb on 4 Jun 2022
Edited: dpb on 6 Jun 2022
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

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!