From: Siming Tian on
I have a matrix
a=[1;1;1;1;1;1;6;6;6;6;6;6;6;0;0;0;0;]

and then I use the tabulate command
ab=tabulate(a)
I got the output like this:
ab =

0 4.0000 23.5294
1.0000 6.0000 35.2941
6.0000 7.0000 41.1765


but, when i use the similar matrix;
b=[6;6;9;9;9;9;]

and then i run:
bb=tabulate(b)
i got this kind of output.
1.0000 0 0
2.0000 0 0
3.0000 0 0
4.0000 0 0
5.0000 0 0
6.0000 2.0000 33.3333
7.0000 0 0
8.0000 0 0
9.0000 4.0000 66.6667

,
could you tell me why i run the same command, but get two kinds of output.
And How I can choose the kind of output?
thank you for help
i appreciate
From: Siming Tian on
"Siming Tian" <tsmvole(a)hotmail.com> wrote in message <hocvtu$nr$1(a)fred.mathworks.com>...
> I have a matrix
> a=[1;1;1;1;1;1;6;6;6;6;6;6;6;0;0;0;0;]
>
> and then I use the tabulate command
> ab=tabulate(a)
> I got the output like this:
> ab =
>
> 0 4.0000 23.5294
> 1.0000 6.0000 35.2941
> 6.0000 7.0000 41.1765
>
>
> but, when i use the similar matrix;
> b=[6;6;9;9;9;9;]
>
> and then i run:
> bb=tabulate(b)
> i got this kind of output.
> 1.0000 0 0
> 2.0000 0 0
> 3.0000 0 0
> 4.0000 0 0
> 5.0000 0 0
> 6.0000 2.0000 33.3333
> 7.0000 0 0
> 8.0000 0 0
> 9.0000 4.0000 66.6667
>
> ,
> could you tell me why i run the same command, but get two kinds of output.
> And How I can choose the kind of output?
> thank you for help
> i appreciate

"TABLE=tabulate(x)
If x is a numeric array, TABLE is
a numeric matrix. If the elements of x are non-negative
integers, TABLE includes 0 counts for integers between 1 and max(x) that
do not appear in x.If x is a character array or a cell array of strings, TABLE is
a cell array."

so, convert the matrix b to sting can solve the problem.

tabulate(num2str( b))