comparison src/data.cc @ 3215:bc3fdfe311a3

[project @ 1998-11-10 14:06:21 by jwe]
author jwe
date Tue, 10 Nov 1998 14:12:07 +0000
parents bf61c443a366
children 041ea33fbbf4
comparison
equal deleted inserted replaced
3214:8cc04ca5b4ca 3215:bc3fdfe311a3
780 780
781 return retval; 781 return retval;
782 } 782 }
783 783
784 DEFUN (isempty, args, , 784 DEFUN (isempty, args, ,
785 "isempty (x): return nonzero if x is an empty matrix or empty list") 785 "isempty (x): return nonzero if x is an empty matrix, string, or list")
786 { 786 {
787 double retval = 0.0; 787 double retval = 0.0;
788 788
789 if (args.length () == 1) 789 if (args.length () == 1)
790 { 790 {
791 octave_value arg = args(0); 791 octave_value arg = args(0);
792 792
793 if (arg.is_matrix_type ()) 793 if (arg.is_matrix_type ())
794 retval = static_cast<double> (arg.rows () == 0 || arg.columns () == 0); 794 retval = static_cast<double> (arg.rows () == 0 || arg.columns () == 0);
795 else if (arg.is_list ()) 795 else if (arg.is_list () || arg.is_string ())
796 retval = static_cast<double> (arg.length () == 0); 796 retval = static_cast<double> (arg.length () == 0);
797 } 797 }
798 else 798 else
799 print_usage ("isempty"); 799 print_usage ("isempty");
800 800