Blame view

matlab/cls_MeanClassFeatures.m 452 Bytes
3e63cf17   David Mayerich   added matlab file...
1
2
3
4
5
6
7
8
9
10
11
12
  function S = cls_MeanClassFeatures(F, T)
  %Calculates the mean set of features for each class given the feature matrix F and targets T
  
  C = unique(T);                          %get the class IDs
  nc = length(C);
  
  S = zeros(nc, size(F, 2));              %allocate space for the mean feature vectors
  for c = 1:nc                            %for each class
      S(c, :) = mean(F(T == C(c), :));    %calculate the mean feature vector for class c
  end
  	
  S = S';