%  [clerr, clerr_percent] = classerr(target, output)

%

%    Input:  target  =  expected target output

%            output  =  actual received output

%

%    Output: clerr_percent  =  percent of misclassified samples

%            clerr          =  number of misclassified samples

%



function [clerr_percent, clerr] = classerr(target, output)



% check arguments

if (nargin < 2)

   error('classerr: invalid number of arguments');

end

s = size(target);

if (size(1,1) ~= 1) | (s ~= size(output))

   error('classerr: invalid input arguments');

end



% find number and percentage of errors in output

clerr = sum(target == output);

clerr_percent = clerr / s(2);

