# HG changeset patch # User Rik # Date 1350422220 25200 # Node ID 360adb4a3136abfe86b1224e01ac54f8d6685e18 # Parent 7d76290fb29b3e55059b0e45946e78e08a571387 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. diff -r 7d76290fb29b -r 360adb4a3136 libinterp/octave-value/ov-struct.cc --- a/libinterp/octave-value/ov-struct.cc Tue Oct 16 14:03:57 2012 -0700 +++ b/libinterp/octave-value/ov-struct.cc Tue Oct 16 14:17:00 2012 -0700 @@ -2144,10 +2144,11 @@ DEFUN (rmfield, args, , "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} rmfield (@var{s}, @var{f})\n\ +@deftypefn {Built-in Function} {@var{s} =} rmfield (@var{s}, \"@var{f}\")\n\ +@deftypefnx {Built-in Function} {@var{s} =} rmfield (@var{s}, @var{f})\n\ Return a copy of the structure (array) @var{s} with the field @var{f}\n\ removed. If @var{f} is a cell array of strings or a character array, remove\n\ -the named fields.\n\ +each of the named fields.\n\ @seealso{cellstr, iscellstr, setfield}\n\ @end deftypefn") { @@ -2192,8 +2193,14 @@ /* ## test rmfield +%!shared x +%! x(3).d=1; x(2).a=2; x(1).b=3; x(2).c=3; x(6).f="abc123"; +%! %!test -%! x(3).d=1; x(2).a=2; x(1).b=3; x(2).c=3; x(6).f="abc123"; +%! y = rmfield (x, "c"); +%! assert (fieldnames (y), {"d"; "a"; "b"; "f"}); +%! assert (size (y), [1, 6]); +%!test %! y = rmfield (x, {"a", "f"}); %! assert (fieldnames (y), {"d"; "b"; "c"}); %! assert (size (y), [1, 6]);