How can I get C code for TriScatteredInterp/scatteredInterpolant from Code Generator in matlab(I have got fun to C using Code Generator )?
5 views (last 30 days)
Show older comments
load 'varianclinac1x1.mat';
phsp = varianclinac1x1;
Ephsp = TriScatteredInterp(phsp(:,1),phsp(:,2),phsp(:,3)); %//error
I am getting error during code generation to C, I have tried replacing TriScatteredInterp with scatteredInterpolant but the matlab function itself gives error in running the line. Please provide an alternative solution to the problem.
4 Comments
Answers (2)
Walter Roberson
on 23 Nov 2017
You cannot generate code from those routines. You will need to find an alternative.
Historically, the MATLAB approach was to use qhull to produce a triangulation, and then for each query point, query which triangle it was in and use the vertices of the triangle to do the interpolation. qhull is a third-party library; if I recall correctly it is from a UK university. If you were producing a commercial product then you might potentially need to negotiate a license to use qhull. (For commercial products, watch out for license conditions on github code as well.)
0 Comments
Kevin
on 14 Mar 2023
CGAL library's linear interpolation can produce almost a same result of "natural" method of scatteredInterpolant. More details shows below
0 Comments
See Also
Categories
Find more on Execution Speed 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!