diff scripts/miscellaneous/substruct.m @ 9774:fbf15a0f30f0

Call user-defined subsref/subsasgn with 1xN structs instead of Nx1
author David Grundberg <davidg@cs.umu.se>
date Tue, 03 Nov 2009 08:52:00 +0100
parents a1dbe9d80eee
children 9d1a14e12431
line wrap: on
line diff
--- a/scripts/miscellaneous/substruct.m
+++ b/scripts/miscellaneous/substruct.m
@@ -31,8 +31,8 @@
 
   if (nargs > 1 && mod (nargs, 2) == 0)
     narg_pairs = nargs / 2;
-    typ = cell (narg_pairs, 1);
-    sub = cell (narg_pairs, 1);
+    typ = cell (1, narg_pairs);
+    sub = cell (1, narg_pairs);
     k = 1;
     for i = 1:2:nargs
       t = varargin{i};
@@ -66,11 +66,11 @@
 
 %!test
 %! x(1,1).type = "()";
-%! x(2,1).type = "{}";
-%! x(3,1).type = ".";
+%! x(1,2).type = "{}";
+%! x(1,3).type = ".";
 %! x(1,1).subs = {1,2,3};
-%! x(2,1).subs = ":";
-%! x(3,1).subs = "foo";
+%! x(1,2).subs = ":";
+%! x(1,3).subs = "foo";
 %! y = substruct ("()", {1,2,3}, "{}", ":", ".", "foo");
 %! assert(x,y);
 %!error assert(substruct);