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

cloose

(tmp_for_tar/misc/cloose.m)


Function Synopsis

a = cloose (f, sz, content)

Help text

 a = cloose(f, [sz, content]) - column-wise loose

 f       : P x Q    : List of indices, padded with zeros. Entries greater
                      than sz are zeroed.
 sz      : 1        : Number of rows in a.         Default=max(f(:))
 content : PxQ or 1 : Values to be put in a.       Default=1

 a(grep (f(:,i),i) = content(grep (f(:,i),i), i) for all i

 See loose().

 Last modified: April 2001



Listing of function file tmp_for_tar/misc/cloose.m

## a = cloose(f, [sz, content]) - column-wise loose
## 
## f       : P x Q    : List of indices, padded with zeros. Entries greater
##                      than sz are zeroed.
## sz      : 1        : Number of rows in a.         Default=max(f(:))
## content : PxQ or 1 : Values to be put in a.       Default=1
##
## a(grep (f(:,i),i) = content(grep (f(:,i),i), i) for all i
## 
## See loose().

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

function a = cloose (f, sz, content)

if nargin<2,
  sz = max (f(:));
else
  if length (sz) != 1,
    printf ("cloose : warning : sz should now have size 1 (previously 2)\n");
    sz = sz(1);
  end
  if ! isempty (tmp = find (f(:)>sz)),
    f(tmp)=0;
  end
end
if nargin<3,
  content = ones (max (sum ([f;zeros(size(f))]!=0)), columns(f));
end
a = zeros (sz, columns (f)) ;
if sz,
  for i=find(any([f;zeros(size(f))])),
    ## keyboard
    tmp = find (f(:,i));
    a(f(tmp,i),i) = content(tmp,i);
  end
end

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