home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / r / rlab / CTB / isvec < prev    next >
Encoding:
Text File  |  1995-11-15  |  723 b   |  31 lines

  1. //-----------------------------------------------------------------------
  2. //
  3. // isvec
  4. //
  5. // Syntax: i=isvec(a)
  6. //
  7. // This routine checks to see if the input a is a vector
  8. // (column or matrix). If it is a vector, then a 1 is returned, otherwise a
  9. // 0 is returned.
  10. // (column or matrix).
  11. //
  12. // Copyright (C), by Jeffrey B. Layton, 1994
  13. // Version JBL 940918
  14. //-----------------------------------------------------------------------
  15.  
  16. isvec = function(a)
  17. {
  18.    local(narg)
  19.  
  20. // count number of input arguments
  21.    narg=0;
  22.    if (exist(a)) { narg=narg+1; }
  23.  
  24.    if (narg == 1) {
  25.        return ( ((a.nr == 1) && (a.nc > 1)) || ((a.nc == 1) && (a.nr > 1)) )
  26.    else
  27.        error("ISVEC: Wrong number of input arguments.");
  28.    }
  29.  
  30. };
  31.