MATLAB: How to use gscatter.I am getting the following error.

gscatter

b1 =
0
0
1
2
1
1
2
2
0
1
b2 =
1
2
1
2
1
9
9
7
8
8
>> gscatter(b1,b2,group,'br','xo') Undefined function or variable 'group'.
>> gscatter(b1,b2,vector,'br','xo') Undefined function or variable 'vector'.
Did you mean: >> gscatter(b1,b2,isvector,'br','xo') Error using isvector Not enough input arguments.
>> gscatter(b1,b2,'br','xo') Error using gscatter (line 83) There must be one value of G for each row of X.
>> gscatter(b1,b2,class,'br','xo') Error using class Not enough input arguments.
>> gscatter(b1,b2,siz,'br','xo') Undefined function or variable 'siz'.
Did you mean: >> gscatter(b1,b2,size,'br','xo') Error using size Not enough input arguments.

Best Answer

Let there be three groups (0,1,2) as defined by b1.
b1 = [0
0
1
2
1
1
2
2
0
1 ] ;
b2 = [1
2
1
2
1
9
9
7
8
8] ;
gscatter(b1,b2,b1,'rbg','xod')