Mercurial > hg > octave-nkf
comparison libinterp/octave-value/ov-struct.cc @ 15534:360adb4a3136
doc: Update docstring form rmfield() and add another %!test.
* libinterp/octave-value/ov-struct.cc(Frmfield): Update docstring.
Add a %! test for first form of calling function.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 16 Oct 2012 14:17:00 -0700 |
parents | 049e8bbff782 |
children | 126285fce876 |
comparison
equal
deleted
inserted
replaced
15533:7d76290fb29b | 15534:360adb4a3136 |
---|---|
2142 // So we can call Fcellstr directly. | 2142 // So we can call Fcellstr directly. |
2143 extern octave_value_list Fcellstr (const octave_value_list& args, int); | 2143 extern octave_value_list Fcellstr (const octave_value_list& args, int); |
2144 | 2144 |
2145 DEFUN (rmfield, args, , | 2145 DEFUN (rmfield, args, , |
2146 "-*- texinfo -*-\n\ | 2146 "-*- texinfo -*-\n\ |
2147 @deftypefn {Built-in Function} {} rmfield (@var{s}, @var{f})\n\ | 2147 @deftypefn {Built-in Function} {@var{s} =} rmfield (@var{s}, \"@var{f}\")\n\ |
2148 @deftypefnx {Built-in Function} {@var{s} =} rmfield (@var{s}, @var{f})\n\ | |
2148 Return a copy of the structure (array) @var{s} with the field @var{f}\n\ | 2149 Return a copy of the structure (array) @var{s} with the field @var{f}\n\ |
2149 removed. If @var{f} is a cell array of strings or a character array, remove\n\ | 2150 removed. If @var{f} is a cell array of strings or a character array, remove\n\ |
2150 the named fields.\n\ | 2151 each of the named fields.\n\ |
2151 @seealso{cellstr, iscellstr, setfield}\n\ | 2152 @seealso{cellstr, iscellstr, setfield}\n\ |
2152 @end deftypefn") | 2153 @end deftypefn") |
2153 { | 2154 { |
2154 octave_value retval; | 2155 octave_value retval; |
2155 | 2156 |
2190 return retval; | 2191 return retval; |
2191 } | 2192 } |
2192 | 2193 |
2193 /* | 2194 /* |
2194 ## test rmfield | 2195 ## test rmfield |
2196 %!shared x | |
2197 %! x(3).d=1; x(2).a=2; x(1).b=3; x(2).c=3; x(6).f="abc123"; | |
2198 %! | |
2195 %!test | 2199 %!test |
2196 %! x(3).d=1; x(2).a=2; x(1).b=3; x(2).c=3; x(6).f="abc123"; | 2200 %! y = rmfield (x, "c"); |
2201 %! assert (fieldnames (y), {"d"; "a"; "b"; "f"}); | |
2202 %! assert (size (y), [1, 6]); | |
2203 %!test | |
2197 %! y = rmfield (x, {"a", "f"}); | 2204 %! y = rmfield (x, {"a", "f"}); |
2198 %! assert (fieldnames (y), {"d"; "b"; "c"}); | 2205 %! assert (fieldnames (y), {"d"; "b"; "c"}); |
2199 %! assert (size (y), [1, 6]); | 2206 %! assert (size (y), [1, 6]); |
2200 */ | 2207 */ |
2201 | 2208 |