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

  1. % function [data,rowpoint,indv,err] = vunpck(mat)
  2. %
  3. %   Unpacks a VARYING matrix. The values of MAT are
  4. %   placed in the variable DATA, stacked one on top of
  5. %   another. The value of ROWPOINT(i) points to the
  6. %   row of DATA which corresponds to the first row of
  7. %   the i'th value of MAT. INDV is a column vector with
  8. %   the INDEPENDENT VARIABLE values. ERR normally is 0,
  9. %   but equals 1 if mat is a SYSTEM matrix.
  10. %
  11. %   See also: GETIV, MINFO, PCK, UNPCK, VPCK, XTRACT and XTRACTI.
  12.  
  13. function [data,rowpoint,indv,err] = vunpck(mat)
  14.  
  15.    if nargin ~= 1
  16.      disp('usage: [data,rowpoint,indv,err] = vunpck(mat)')
  17.      return
  18.    end
  19.  
  20.   err = 0;
  21.   [type,rows,cols,num] = minfo(mat);
  22.   if type == 'vary'
  23.     indv = mat(1:num,cols+1);
  24.     rowpoint = rows*(0:num-1) + 1;
  25.     colpoint = cols;
  26.     data = mat(1:num*rows,1:cols);
  27.   elseif type == 'cons'
  28.     data = mat;
  29.     rowpoint = rows;
  30.     indv = [];
  31.   else
  32.     data = [];
  33.     rowpoint = [];
  34.     indv = [];
  35.     err = 1;
  36.   end
  37.     
  38. %
  39. % Copyright MUSYN INC 1991,  All Rights Reserved
  40.