Matlab中分类表的直方图

时间:2014-10-25 15:31:41

标签: matlab count unique histogram

我的表tNonNumeric仅包含分类值。我试图找到独特的元素以及它们出现在我的表格中的次数。不是我的实际数据,而是可以使用以下内容:

LastName = {'Smith';'Johnson';'Williams';'Jones';'Brown'};
Age = [38;43;38;40;49];
FirstName = {'Amanda' ;'Brenda';'Carl'; 'Denis'; 'Ethan'};
Something = {'String1' ;'String2';'String2'; 'String1'; 'String5'};
Weight = [176;163;131;133;119];
FavoriteColor = {'blue' ;'red' ;'yellow'; 'orange' ;'colorblind' };
T = table(Age,FirstName,Weight,FavoriteColor,Something,'RowNames',LastName)
T.FavoriteColor= categorical(T.FavoriteColor);
T.Something= categorical(T.Something); 

那么如何将直方图应用于分类值?

1 个答案:

答案 0 :(得分:0)

函数直方图不适用于分类数据,但hist确实:

hist(T.Something)