Clear Filters
Clear Filters

How do I change step interval in a frequency table in matlab

2 views (last 30 days)
Hi all!
I have created a frequency table as follows:
A = [220 200 170 160 150 165 200 300 350 400 400 350 380 360 350 330 300 350 400 420 480 550 500 350];
B = tabulate(A);
Which results in 550x3 table, starting from 1 up to the maximum value of A, how do I limit it only to those 24 values?

Accepted Answer

Jos (10584)
Jos (10584) on 13 Jul 2017
The help of TABULATE states: If the elements of X are non-negative integers, then the output includes 0 counts for any integers that are between 1 and max(X) but do not appear in X.
I do not know the reason behind this behaviour, but it does suggest the following solution: 1. add a negative value to the input 2. remove this entry after tabulation
A = [5 5 7 10 10 10]
B = tabulate([A(:) ; -Inf])
B = B(2:end,:)

More Answers (0)

Categories

Find more on Tables 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!