フィルターのクリア

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

2 ビュー (過去 30 日間)
Yerzhigit Bapin
Yerzhigit Bapin 2017 年 7 月 13 日
回答済み: Jos (10584) 2017 年 7 月 13 日
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 Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by