Tabulate Not Adding Up?

1 view (last 30 days)
Hannah Schultejans
Hannah Schultejans on 14 Aug 2015
Answered: the cyclist on 14 Aug 2015
I've been using tabulate to generate a frequency table for my logical array. My code looks like this:
A.logical = [1;0;0;0;1;1;1;1;1;1];
A.logical.stats.freq = tabulate(A.logical);
And my resulting table SHOULD be
0 3 30
1 7 70
where column 1 is the numeric values, column 2 is frequency, and column 3 is percentage.
However, what I am getting is more like
0 300 30
1 700 70
Why is this happening and how can I fix it?

Answers (1)

the cyclist
the cyclist on 14 Aug 2015
Your code gave an error for me. I ran this code instead:
A.logical = [1;0;0;0;1;1;1;1;1;1]
Atab = tabulate(A.logical)
and ended up with
Atab =
0 3 30
1 7 70
as expected.

Categories

Find more on Discrete Multiresolution Analysis in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!