function out = ArrayFilter(filter, in)
    % ARRAYFILTER   Filters array by function handle
    %   Written by Grant Elliott, June 2011
    %
    %   output = ArrayFilter(filter, input) where input is an array and filter is a function
    %   handle returns an array containing only those entries for which filter returns true.
    %
    %   pass=filter(x) is a function handle which takes a single argument and returns a boolean
    out = in(arrayfun(filter,in));
end