diff +grid/evalOn.m @ 943:21394c78c72e feature/utux2D

Merge with default
author Martin Almquist <malmquist@stanford.edu>
date Tue, 04 Dec 2018 15:24:36 -0800
parents 77451445955f
children
line wrap: on
line diff
--- a/+grid/evalOn.m	Tue Dec 04 14:54:28 2018 -0800
+++ b/+grid/evalOn.m	Tue Dec 04 15:24:36 2018 -0800
@@ -13,18 +13,18 @@
         return
     end
     % func should now be a function_handle
-    assert(g.D == nargin(func),'grid:evalOn:WrongNumberOfInputs', 'The number of inputs of the function must match the dimension of the domain.')
+    assert(g.D == nargin(func) || nargin(func) < 0,'grid:evalOn:WrongNumberOfInputs', 'The number of inputs of the function must match the dimension of the domain.')
 
     x = num2cell(g.points(),1);
-    k = numberOfComponents(func);
+    k = numberOfComponents(func, g.D);
 
     gf = func(x{:});
     gf = reorderComponents(gf, k);
 end
 
 % Find the number of vector components of func
-function k = numberOfComponents(func)
-    x0 = num2cell(ones(1,nargin(func)));
+function k = numberOfComponents(func, dim)
+    x0 = num2cell(ones(1, dim));
     f0 = func(x0{:});
     assert(size(f0,2) == 1, 'grid:evalOn:VectorValuedWrongDim', 'A vector valued function must be given as a column vector');
     k = length(f0);