How can I get C code for TriScatter​edInterp/s​catteredIn​terpolant from Code Generator in matlab(I have got fun to C using Code Generator )?

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

What error you are getting? You have not specified any error..
Neither of those functions is supported for code generation.
whether any alternative way for function 'TriScatteredInterp' or method that help with C Code Generation.

Sign in to comment.

Answers (2)

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.)

Categories

Asked:

on 23 Nov 2017

Answered:

on 14 Mar 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!