function [cas, savedCombs] = findFeatures( features, conds, range ) N_Features = size(features,2); numberOfCombs = sum(arrayfun(@(k) nchoosek(size(features,2),k), range)); cas = zeros( numberOfCombs,1 ); savedCombs = cell( numberOfCombs,1 ); count = 1; combs = []; for i=range combs = combnk(1:N_Features,i); temporaryCas = zeros(1,size(combs,1)); parfor t=1:size(combs,1) currentComb = combs(t,:); ca = knnEvaluate(features(:,currentComb),conds); disp(['Current Comb: ' num2str(currentComb) ' Classificaiton accuracy: ' num2str(ca)]); %cas( count ) = ca; %savedCombs{ count } = currentComb; temporaryCas(t) = ca; end savedCombs(count:(count + size(combs,1) - 1)) = (num2cell(combs,2))'; cas(count:(count + size(combs,1) - 1)) = temporaryCas; count = count + size(combs,1); end end