Mercurial > hg > octave-lyh
comparison src/data.cc @ 2420:449f35baba49
[project @ 1996-10-16 18:46:25 by jwe]
author | jwe |
---|---|
date | Wed, 16 Oct 1996 18:46:26 +0000 |
parents | c90105b99479 |
children | e93b4c32457b |
comparison
equal
deleted
inserted
replaced
2419:015cbef2b75f | 2420:449f35baba49 |
---|---|
781 } | 781 } |
782 | 782 |
783 DEFUN (struct_contains, args, , | 783 DEFUN (struct_contains, args, , |
784 "struct_contains (S, NAME)\n\ | 784 "struct_contains (S, NAME)\n\ |
785 \n\ | 785 \n\ |
786 return nonzero if S is a structure with element NAME") | 786 Return nonzero if S is a structure with element NAME.\n\ |
787 S must be a structure and NAME must be a string.") | |
787 { | 788 { |
788 octave_value_list retval; | 789 octave_value_list retval; |
789 | 790 |
790 int nargin = args.length (); | 791 int nargin = args.length (); |
791 | 792 |
792 if (nargin == 2) | 793 if (nargin == 2) |
793 { | 794 { |
794 retval = 0.0; | 795 retval = 0.0; |
796 | |
795 if (args(0).is_map () && args(1).is_string ()) | 797 if (args(0).is_map () && args(1).is_string ()) |
796 { | 798 { |
797 string s = args(1).string_value (); | 799 string s = args(1).string_value (); |
798 octave_value tmp = args(0).struct_elt_val (s); | 800 octave_value tmp = args(0).struct_elt_val (s, true); |
799 retval = (double) tmp.is_defined (); | 801 retval = (double) tmp.is_defined (); |
800 } | 802 } |
803 else | |
804 print_usage ("struct_contains"); | |
801 } | 805 } |
802 else | 806 else |
803 print_usage ("struct_contains"); | 807 print_usage ("struct_contains"); |
804 | 808 |
805 return retval; | 809 return retval; |