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

cfind

(tmp_for_tar/misc/cfind.m)


Function Synopsis

f = cfind(a)

Help text

       f = cfind(a)

 a : RxC
 f : WxC  : The result of 'find()' on each of a's columns, padded with
            zeros.

 a(f(i,find(f(i,:))),i) are the only non-zero elements of  a.

 Last modified: April 2001



Listing of function file tmp_for_tar/misc/cfind.m

##       f = cfind(a)
##  
## a : RxC
## f : WxC  : The result of 'find()' on each of a's columns, padded with
##            zeros.
## 
## a(f(i,find(f(i,:))),i) are the only non-zero elements of  a.
##

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

function f = cfind(a)

[R,C] = size(a) ;
W = max(sum([a;a]|0))/2 ; 
f = zeros(W,C) ;
if W,
  for i=1:C,
    tmp = find(a(:,i)) ;
    ## keyboard
    f(1:size(tmp,1),i) = tmp ;
  end
end

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