Mercurial > hg > octave-lyh
comparison src/data.cc @ 3373:36405da8e173
[project @ 1999-11-23 20:54:17 by jwe]
author | jwe |
---|---|
date | Tue, 23 Nov 1999 20:54:31 +0000 |
parents | f37ca3017116 |
children | ca92c9d3f882 |
comparison
equal
deleted
inserted
replaced
3372:f16c2ce14886 | 3373:36405da8e173 |
---|---|
590 | 590 |
591 return retval; | 591 return retval; |
592 } | 592 } |
593 | 593 |
594 DEFUN (length, args, , | 594 DEFUN (length, args, , |
595 "length (x): return the `length' of the object X\n\ | 595 "-*- texinfo -*-\n\ |
596 \n\ | 596 @deftypefn {Built-in Function} {} length (@var{a})\n\ |
597 For matrix objects, the length is the number of rows or columns,\n\ | 597 Return the `lenghth' of the object @var{a}. For matrix objects, the\n\ |
598 whichever is greater (this odd definition is used for compatibility\n\ | 598 length is the number of rows or columns, whichever is greater (this\n\ |
599 with Matlab).\n\ | 599 odd definition is used for compatibility with Matlab).\n\ |
600 \n\ | 600 @end deftypefn") |
601 See also: size, rows, columns, is_scalar, is_vector, is_matrix") | |
602 { | 601 { |
603 octave_value retval; | 602 octave_value retval; |
604 | 603 |
605 if (args.length () == 1) | 604 if (args.length () == 1) |
606 { | 605 { |
614 | 613 |
615 return retval; | 614 return retval; |
616 } | 615 } |
617 | 616 |
618 DEFUN (size, args, nargout, | 617 DEFUN (size, args, nargout, |
619 "[m, n] = size (x): return rows and columns of X\n\ | 618 "-*- texinfo -*-\n\ |
620 \n\ | 619 @deftypefn {Built-in Function} {} size (@var{a}, @var{n})\n\ |
621 d = size (x): return number of rows and columns of x as a row vector\n\ | 620 Return the number rows and columns of @var{a}.\n\ |
622 \n\ | 621 \n\ |
623 m = size (x, 1): return number of rows in x\n\ | 622 With one input argument and one output argument, the result is returned\n\ |
624 m = size (x, 2): return number of columns in x") | 623 in a 2 element row vector. If there are two output arguments, the\n\ |
624 number of rows is assigned to the first, and the number of columns to\n\ | |
625 the second. For example,\n\ | |
626 \n\ | |
627 @example\n\ | |
628 @group\n\ | |
629 size ([1, 2; 3, 4; 5, 6])\n\ | |
630 @result{} [ 3, 2 ]\n\ | |
631 \n\ | |
632 [nr, nc] = size ([1, 2; 3, 4; 5, 6])\n\ | |
633 @result{} nr = 3\n\ | |
634 @result{} nc = 2\n\ | |
635 @end group\n\ | |
636 @end example\n\ | |
637 \n\ | |
638 If given a second argument of either 1 or 2, @code{size} will return\n\ | |
639 only the row or column dimension. For example\n\ | |
640 \n\ | |
641 @example\n\ | |
642 size ([1, 2; 3, 4; 5, 6], 2)\n\ | |
643 @result{} 2\n\ | |
644 @end example\n\ | |
645 \n\ | |
646 @noindent\n\ | |
647 returns the number of columns in the given matrix.\n\ | |
648 @end deftypefn") | |
625 { | 649 { |
626 octave_value_list retval; | 650 octave_value_list retval; |
627 | 651 |
628 int nargin = args.length (); | 652 int nargin = args.length (); |
629 | 653 |
787 | 811 |
788 return retval; | 812 return retval; |
789 } | 813 } |
790 | 814 |
791 DEFUN (isempty, args, , | 815 DEFUN (isempty, args, , |
792 "isempty (x): return nonzero if x is an empty matrix, string, or list") | 816 "-*- texinfo -*-\n\ |
817 @deftypefn {Built-in Function} {} isempty (@var{a})\n\ | |
818 Return 1 if @var{a} is an empty matrix (either the number of rows, or\n\ | |
819 the number of columns, or both are zero). Otherwise, return 0.\n\ | |
820 @end deftypefn") | |
793 { | 821 { |
794 double retval = 0.0; | 822 double retval = 0.0; |
795 | 823 |
796 if (args.length () == 1) | 824 if (args.length () == 1) |
797 { | 825 { |
834 return retval; | 862 return retval; |
835 } | 863 } |
836 | 864 |
837 DEFUN (is_matrix, args, , | 865 DEFUN (is_matrix, args, , |
838 "-*- texinfo -*-\n\ | 866 "-*- texinfo -*-\n\ |
839 @deftypefn {Usage} {} is_matrix (@var{a})\n\ | 867 @deftypefn {Built-in Function} {} is_matrix (@var{a})\n\ |
840 Return 1 if @var{a} is a matrix. Otherwise, return 0.\n\ | 868 Return 1 if @var{a} is a matrix. Otherwise, return 0.\n\ |
841 @end deftypefn") | 869 @end deftypefn") |
842 { | 870 { |
843 double retval = 0.0; | 871 double retval = 0.0; |
844 | 872 |