Getting Simulink compile-time error "Grid inputs must be vectors or the output of MESHGRID" even though I don't get that error when I try testing those lines in MATLAB

5 views (last 30 days)
Hi everyone. I have a table of aerodynamic coefficients and I'm trying to interpolate within them and do a spline extrapolation outside of them. I am passing in the Mach number and Angle of attack to a MATLAB function block, and I'm passing that through interpn in the following way:
aero.Cmdh = interpn(params.aero.Cmdh.X, params.aero.Cmdh.Y, params.aero.Cmdh.V, Mach, alpha, "spline");
When I do this, I get the following error at compile-time:
"Grid inputs must be vectors or the output of MESHGRID. Error in '.../MATLAB Function'."
I'm assuming it's during compile-time because any breakpoints I put within the function are not triggered. However, when I open up an empty MATLAB file and run the line of code provided above, I don't get any errors, and get a reasonable output. Why is it that I don't get any errors in MATLAB but get errors in Simulink? How do I fix this issue? Any kind of insight would be greatly appreciated.

Answers (1)

Paul
Paul on 24 Oct 2022
That's an odd error message insofar as interpn actually requires the the grid inputs to be the output of NDGRID (not MESHGRID) accordig to interpn.
Regardless of the error message, how is the params struct being passed inot the Matlab Function block?
How are the fields params.aero.Cmdh.* created?

Categories

Find more on Interpolation in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!