MATLAB: Calculating the percentage for unique values

matrix

I have values
result =
{6x4 cell}
{5x4 cell}
{4x4 cell}
{3x3 cell}
'' 'c1' 'c2' 'c3'
'Par1' 'P' 'P' 'P'
'Par2' 'SPSO' 'PSO' 'MPSO'
'Par3' 'PSO' 'PSO' 'PSO'
'Par4' 'MPSO' 'MPSO' 'MPSO'
'Par5' 'SPSO' 'PSO' 'PSO'
In result{1,1} i have
'' 'c1' 'c2' 'c3'
'Par1' 'P' 'P' 'P'
'Par2' 'SPSO' 'PSO' 'MPSO'
'Par3' 'MPSO' 'PSO' 'PSO'
'Par4' 'MPSO' 'MPSO' 'MPSO'
'Par5' 'PSO' 'SPO' 'PSO'
in par2 all values in 3 columns are different so it must be omitted
in par3 there are 3 numbers of PSO so the percentage is 60(3/5*100)
in par4 there are 3 numbers of MPSO so the percentage is 60(3/5*100)
in par5 there a are 3 numbers of PSO(PSO is same as SPO OR POS) so the percentage is 60(3/5*100)
SAME WAY MPSO is same as PSOMor combination of these four words
please tell how to process

Best Answer

nr=size(result,1)
for k=1:nr
A=result{k};
[n,m]=size(A)
for i1=2:n
test(i1-1)=1
p=perms(char(A(i1,2)))
for j1=3:m
test(i1-1)=and(min(min(ismember(p,char(A(i1,j1))))),test(i1-1));
end
end
perc{k}=[100*(m-1)/(n-1)*test]'
end