clear all;clc;close all

labels=textread('signal_class_acronyms.config','%s');
data=dlmread('stats.txt');

%Format and ged rid of classes less than 10%
th=0.025;
N=length(labels);
totals=sum(data);
misc_ind=NaN;
del_ind=[];
for n=1:N
    if( th > (data(n)/totals) )
        if(isnan(misc_ind))
            misc_ind=n;
            labels{misc_ind}='Others';
        else
            data(misc_ind)=data(misc_ind)+data(n);
            del_ind(end+1)=n;
        end
    else   
    labels{n}=[labels{n} ' (' num2str((data(n))) ' )'];
    end
end
labels{misc_ind}=[labels{misc_ind} ' (' num2str((data(misc_ind))) ')'];

if(~isempty(del_ind))
data(del_ind)=[];
labels(del_ind)=[];
end

pie(data,labels)
colormap jet