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

1 次查看(过去 30 天)
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?

采纳的回答

Jos (10584)
Jos (10584) 2017-7-13
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,:)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by