# HG changeset patch # User A.R. Burgers # Date 1687295276 -7200 # Tue Jun 20 23:07:56 2023 +0200 # Node ID c19779d695d0805f22f4f257945402fb8976fad0 # Parent addd99059d4cbe778146fc7d51c2859f76d75bd2 inputParser.m: fix bug when both positional and multiple parameter are not specified * add_missing method: avoid horizontal concatenation of scalar and column vector diff -r addd99059d4c -r c19779d695d0 scripts/miscellaneous/inputParser.m --- a/scripts/miscellaneous/inputParser.m Tue Jun 20 15:57:37 2023 -0400 +++ b/scripts/miscellaneous/inputParser.m Tue Jun 20 23:07:56 2023 +0200 @@ -678,7 +678,7 @@ this.Results = ... cell2struct (vertcat (struct2cell (this.Results), unmatched_def), [Resultnames; unmatched_names]); - this.UsingDefaults = [this.UsingDefaults, unmatched_names]; + this.UsingDefaults = [this.UsingDefaults, unmatched_names']; endif endfunction @@ -1044,6 +1044,16 @@ %! assert (fieldnames (p.Results), {'a'}); %! assert (p.Results.a, 20); +%!test <*64318> +%! p = inputParser (); +%! p.addOptional ('a',[]); +%! p.addParameter ('p1',1); +%! p.addParameter ('p2',2); +%! p.parse (); +%! assert (p.Results.a, []); +%! assert (p.Results.p1, 1); +%! assert (p.Results.p2, 2); + %!test <*49793> %! p = inputParser (); %! p.addRequired ("name", @(x) validateattributes (x, {'char'}, {'nonempty'}));