Codegen fails with "wrong number of input arguments" while function calls without error
Show older comments
I'm trying to generate a mex file for the following function:
function matInt = testfun(a,b,M)
matfun = @(x) squeeze(interpn([-1 0 1],[-1,0,1],M,x(1),x(2)));
matInt = integral(@(s) matfun(a*s+(1-s)*b), 0, 1, 'ArrayValued',true);
end
using the following script:
clear; close all;
%% Test arguments
a = [.5;.3];
b = [-.2;-1];
M = randn(3,3,5,5);
%% Run function
Mint = testfun(a,b,M); % okay
%% Codegen
% error:
codegen testfun -args {a,b,M}
Running the function (so computing Mint) goes fine without any errors. But generating a mex file using the same input arguments (in the last line) throws the error:
??? Wrong number of input arguments.
Error in ==> testfun Line: 2 Column: 23
Code generation failed: View Error Report
I'm not exactly what goes wrong there, as I do not see how I do not give the correct number of input arguments.
Accepted Answer
More Answers (0)
Categories
Find more on Algorithm Design Basics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!