home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 2.ddi / MUTOOLS1.DI$ / VPCK.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  871 b   |  37 lines

  1. % function out = vpck(mat,indv)
  2. %
  3. %   Pack a VARYING matrix from stacked matrix
  4. %   and independent variable data.
  5. %
  6. %   See also: GETIV, MINFO, PCK, UNPCK, VUNPCK
  7. %             XTRACT and XTRACTI.
  8.  
  9. function out = vpck(mat,omega)
  10.  
  11.    if nargin < 2
  12.      disp('usage: out = vpck(mat,indv)')
  13.      return
  14.    end
  15.  if isempty(mat) | isempty(omega)
  16.    out = [];
  17.  else
  18.    [nr,nc] = size(mat);
  19.    if min(size(omega)) ~= 1
  20.      error('independent variable data should be a VECTOR')
  21.      return
  22.    end
  23.    [nro,nco] = size(omega);
  24.    npts = nro;
  25.    if nro == 1
  26.      omega = omega.';
  27.      npts = nco;
  28.    end
  29.    if floor(nr/npts) ~= ceil(nr/npts)
  30.      error('matrix data and IV have incompatible row data')
  31.      return
  32.    end
  33.    out = [mat [omega; zeros(nr-npts,1)];[zeros(1,nc-1) npts inf]];
  34.  end
  35. %
  36. % Copyright MUSYN INC 1991,  All Rights Reserved
  37.