0
my data matrix has 19 rows and 396 columns.

row 1=[0 -1 0 1......]
row 2=[1 0 -1 1 1 0...]
.
.
row 19=[1 -1 0 1 0 0..]

how should I code this using plot function in Matlab ? given below:

if(bit==1)
   X axis= X++;
   Y axis= Y++;
   /*graph will show increment by 1 */
else if (bit==-1)
  X axis = X++;
  Y axis = Y--;
  /* graph will show decrements by 1*/
5
  • 2
    Its not clear to me how you want the graph to look. Can you include an example? Commented Mar 9, 2016 at 7:00
  • you could use cumsum (twice), ndgrid and surf. Or just imshow Commented Mar 9, 2016 at 7:06
  • @ mhopeng foreaxmple: row 1=[0 0 1...] row 2=[1 0 1...] take row 1 first bit is 0 so point must plot on (1,1) next bit is 0 so point must plot on (2,2) next bit is 1 so plot on(3,1) and so on take row 2 first bit is 1 so plot on (1,-1) next bit is 0 so plot on (2,0) and so on basically 0 show increment by 1 and 1 shows decrement by 1 ... by plotting this type of graph ...it become easy for me to analyse similar pattern of bit strings ...and those bit strings shows similar pattern will be on one cluster..remember X axis is columns and Y axis is rows ..that's all i want to say Commented Mar 9, 2016 at 7:38
  • @mhopeng i want line graph for all the rows..each row represents bit strings.. Commented Mar 9, 2016 at 7:42
  • any one who wants to answer my question.. Commented Mar 9, 2016 at 9:10

1 Answer 1

4
A = randi(2,10,10); %// create random matrix with ones and twos
A(A==2)=0;          %// set 2 to 0
imagesc(A)          %// plot your binary matrix

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.