MATLAB: I need to plot 8 bit long 256 data in two dimension axis

2d plot

Hello
I have 500 data with variation 0~255.Now I need to convert it in binary at first 8 bit long…like 0 is 0000 0000 and 255 as 1111 1111
Now on the X axis i shall put 0 to 15…and Y axis I shall put at 0 to 15 i.e I need to put in X axis from 0000 to 1111 same for Y axis 0000 to 1111 need to plot.
So how shall I put suppose no 227 ie in binary 11100011?

Best Answer

y = mod(YourData, 16);
x = fix(YourData ./ 16);
scatter(x, y)
Notice I only did a 2D plot. You have not indicated what your Z value should be.
You have also not indicated what you want to have happen when multiple values map to the same (X,Y) coordinates, as must happen when you have more than 256 entries in your matrix.