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

2 次查看(过去 30 天)
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.

回答(1 个)

Paul
Paul 2022-10-24
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?

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by