Codegen fails with "wrong number of input arguments" while function calls without error
이전 댓글 표시
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.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Algorithm Design Basics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!