annotate libinterp/octave-value/ov-null-mat.cc @ 30565:83f9f8bda883

maint: Merge stable to default.
author John W. Eaton <jwe@octave.org>
date Tue, 28 Dec 2021 18:59:33 -0500
parents 841a10208c38 796f54d4ddbf
children e88a07dec498
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
3 // Copyright (C) 2008-2022 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21647
diff changeset
26 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21200
diff changeset
27 # include "config.h"
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
28 #endif
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
29
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
30 #include "ov-null-mat.h"
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
31 #include "ops.h"
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
32 #include "defun.h"
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
33
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
34 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_null_matrix, "null_matrix",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
35 "double");
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
36
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
37 const octave_value octave_null_matrix::instance (new octave_null_matrix ());
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
38
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
39 static octave_base_value *
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
40 default_null_matrix_numeric_conversion_function (const octave_base_value& a)
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
41 {
8677
095ae5e0a831 eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents: 8345
diff changeset
42 // The cast is not necessary?
21647
66cae7a6dc47 eliminate some macros for operator definitions
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
43 // const octave_null_matrix& v = dynamic_cast<const octave_null_matrix&> (a);
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
44
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
45 return a.empty_clone ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
46 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
47
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
48 octave_base_value::type_conv_info
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
49 octave_null_matrix::numeric_conversion_function (void) const
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
50 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
51 return octave_base_value::type_conv_info
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
52 (default_null_matrix_numeric_conversion_function,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
53 octave_matrix::static_type_id ());
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
54 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
55
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
56 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_null_str, "null_string", "char");
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
57
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
58 const octave_value octave_null_str::instance (new octave_null_str ());
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
59
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
60 static octave_base_value *
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
61 default_null_str_numeric_conversion_function (const octave_base_value& a)
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
62 {
8677
095ae5e0a831 eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents: 8345
diff changeset
63 // The cast is not necessary?
21647
66cae7a6dc47 eliminate some macros for operator definitions
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
64 // const octave_null_str& v = dynamic_cast<const octave_null_str&> (a);
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
65
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
66 return a.empty_clone ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
67 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
68
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
69 octave_base_value::type_conv_info
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
70 octave_null_str::numeric_conversion_function (void) const
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
71 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
72 return octave_base_value::type_conv_info
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
73 (default_null_str_numeric_conversion_function,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
74 octave_char_matrix_str::static_type_id ());
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
75 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
76
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
77 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_null_sq_str, "null_sq_string",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
78 "char");
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
79
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
80 const octave_value octave_null_sq_str::instance (new octave_null_sq_str ());
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
81
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
82 static octave_base_value *
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
83 default_null_sq_str_numeric_conversion_function (const octave_base_value& a)
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
84 {
8677
095ae5e0a831 eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents: 8345
diff changeset
85 // The cast is not necessary?
21647
66cae7a6dc47 eliminate some macros for operator definitions
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
86 // const octave_null_sq_str& v = dynamic_cast<const octave_null_sq_str&> (a);
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
87
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
88 return a.empty_clone ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
89 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
90
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
91 octave_base_value::type_conv_info
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
92 octave_null_sq_str::numeric_conversion_function (void) const
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
93 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
94 return octave_base_value::type_conv_info
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
95 (default_null_sq_str_numeric_conversion_function,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
96 octave_char_matrix_sq_str::static_type_id ());
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
97 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
98
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
99 OCTAVE_NAMESPACE_BEGIN
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
100
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
101 DEFUN (isnull, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
102 doc: /* -*- texinfo -*-
30559
841a10208c38 doc: Use TF for output variable in documentation for isXXX functions in libinterp/ directory.
Rik <rik@octave.org>
parents: 29958
diff changeset
103 @deftypefn {} {@var{tf} =} isnull (@var{x})
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
104 Return true if @var{x} is a special null matrix, string, or single quoted
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
105 string.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
106
24161
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
107 Indexed assignment with such a null value on the right-hand side should delete
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
108 array elements. This function is used in place of @code{isempty} when
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
109 overloading the indexed assignment method (@code{subsasgn}) for user-defined
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
110 classes. @code{isnull} is used to distinguish between these two cases:
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
111
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
112 @code{@var{A}(@var{I}) = []}
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
113
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
114 and
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
115
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
116 @code{@var{X} = []; @var{A}(@var{I}) = @var{X}}
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
117
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
118 In the first assignment, the right-hand side is @code{[]} which is a special
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
119 null value. As long as the index @var{I} is not empty, this code should
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
120 delete elements from @var{A} rather than perform assignment.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
121
24161
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
122 In the second assignment, the right-hand side is empty (because @var{X} is
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
123 @code{[]}), but it is @strong{not} null. This code should assign the empty
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
124 value to elements in @var{A}.
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
125
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
126 An example from Octave's built-in char class demonstrates the interpreter
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
127 behavior when @code{isnull} is used correctly.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
128
24161
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
129 @example
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
130 @group
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
131 str = "Hello World";
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
132 nm = "Wally";
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
133 str(7:end) = nm # indexed assignment
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
134 @result{} str = Hello Wally
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
135 str(7:end) = "" # indexed deletion
24208
eec262017c6a maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 24161
diff changeset
136 @result{} str = Hello
24161
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
137 @end group
48cf0f4cc7c8 Clarify documentation for isnull (bug #5035950359503595035950359)
Rik <rik@octave.org>
parents: 23589
diff changeset
138 @end example
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
139 @seealso{isempty, isindex}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
140 @end deftypefn */)
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
141 {
20818
cef0448a6ed2 eliminate unnecessary uses of nargin
John W. Eaton <jwe@octave.org>
parents: 20797
diff changeset
142 if (args.length () != 1)
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
143 print_usage ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
144
23589
63950abd2f81 maint: Deprecate is_null_type and replace with isnull.
Rik <rik@octave.org>
parents: 23220
diff changeset
145 return ovl (args(0).isnull ());
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
146 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
147
12814
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
148 /*
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
149 %!assert (isnull ([]), true)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
150 %!assert (isnull ([1]), false)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
151 %!assert (isnull (zeros (0,3)), false)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
152 %!assert (isnull (""), true)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
153 %!assert (isnull ("A"), false)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
154 %!assert (isnull (''), true)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
155 %!assert (isnull ('A'), false)
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
156 %!test
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
157 %! x = [];
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
158 %! assert (isnull (x), false);
ce1fb93d884d codesprint: Add tests for isnull()
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
159 */
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
160
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
161 OCTAVE_NAMESPACE_END