如何使用Matlab绘制输入[-1 0 1]?

时间:2016-03-09 06:56:48

标签: matlab plot

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..]

我应该如何使用Matlab中的绘图功能对此进行编码?如下:

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*/

1 个答案:

答案 0 :(得分: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