Tabulate Not Adding Up?

5 vues (au cours des 30 derniers jours)
Hannah Schultejans
Hannah Schultejans le 14 Août 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?

Réponses (1)

the cyclist
the cyclist le 14 Août 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.

Catégories

En savoir plus sur Discrete Multiresolution Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by