[Index for tmp_for_tar/misc] [Return to Master Index]

grep

(tmp_for_tar/misc/grep.m)


Function Synopsis

[y,f] = grep(x)

Help text

       y = grep(x) ==  x(find(x))
   [y,f] =         == [x(find(x)),find(x)]

 This function is just to save typing and improve readability, as in

   foo(find(foo(:,p)),p)  vs.  grep(foo(:,p)) 

 Last modified: October 2000



Listing of function file tmp_for_tar/misc/grep.m

##       y = grep(x) ==  x(find(x))
##   [y,f] =         == [x(find(x)),find(x)]
##
## This function is just to save typing and improve readability, as in
##
##   foo(find(foo(:,p)),p)  vs.  grep(foo(:,p)) 

## Author:        Etienne Grossmann  <etienne@isr.ist.utl.pt>
## Last modified: October 2000

function [y,f] = grep(x)
y = x(f = find(x));
## That does not seem to improve anything
#    if nargout<2,
#      y = x(find(x));
#    else
#      y = x(f = find(x));
#    end

Produced by oct2html on Sat Apr 28 21:14:54 2001
Cross-Directory links are: ON