function ex_v = AI_get_examples(examples,a_index,a_val)
%
% AI_get_examples - get examples with attribute value
% Call:
%     ex1 = A_get_examples(ex,2,0);
% On input:
%     examples (mxn array): training set
%     a_index (scalar): attribute index
%     a_val (scalar): attribute value
% On output:
%     ex_v (pxn array): subset of examples with attribute value
% Custom functions used:
%     none
% Author:
%     T. Henderson, UU, 11/2002
% Method:
%      

[num_examples,num_cols] = size(examples);
ex_v = examples;
for e = 1:num_examples
   if (examples(e,num_cols-1)==1) & (examples(e,a_index)==a_val)
      ex_v(e,num_cols-1) = 1;
   else
      ex_v(e,num_cols-1) = 0;
   end
end
