How to convert interpn() to C
Show older comments
To get to know Matlab coder I would like to convert the following code to C:
function [] = Test()
x = [1 2 3 4 5 6 7];
% values of sample points
v = [7 16 31 10 6 0 1];
%query points in x
xq = (1:0.1:7);
%call interpn()
vq = interpn(x,v,xq, 'cubic');
if coder.target('MATLAB')
if ~isempty(vq)
figure
plot(x,v,'o',xq,vq,'-b'); hold on;
legend('Samples', 'Cubic Interpolation');
end
end
The C code it produces is as follows:
:
:
/* Function Definitions */
void Test(void)
{
/* values of sample points */
/* query points in x */
/* call interpn() */
}
/* End of code generation (Test.c) */
In the C code there is no call to any interpn() function even though the help states that C/C++ code can be generated out of it.
What am I doing wrong?
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Coder 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!