How to use griddata in simulink's matlab function block?

Hi,
I want to use griddata in simulink's matlab function block. But when I do this I saw error statements in Simulink as shown below
  • The function 'griddata' is not supported for standalone code generation. See the documentation for coder.extrinsic to learn how you can use this function in simulation.
Can anyone tell me what would be the problem
Thank you,
Manoj.

 채택된 답변

Walter Roberson
Walter Roberson 2019년 4월 28일
You can turn all acceleration off so that it does not attempt to generate code.
You can turn acceleration to the next lowest level, and put the line
coder.extrinsic('griddata');
in your code near the top. Code will be generated and will be able to call into matlab.
For any higher level of acceleration you would need to rewrite the code to not call griddata.

댓글 수: 4

Hi,
I used coder.extrinsic and matlab showed me this
  • Function output 'isdref' cannot be an mxArray in this context. Consider preinitializing the output variable with a known type.
where isdref is one of my outputs
Initialize the variable with zeros() the size that you expect it to be. That signals to the coder to pull the contents of the variable back into the workspace instead of just carrying around a pointer to the variable.
Hi, when I intialize the variable for example like: isdref=zeros(100,1);
simulink showed me the following error.
Caused by:
  • Size mismatch for MATLAB expression 'griddata'. Expected = 1x100 Actual = 1x1
But when I intialized the variable like isdref=zeros(1,1) the model is working, but it doesn't give correct result.
See coder.varsize()

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품

릴리스

R2017b

질문:

2019년 4월 28일

댓글:

2019년 4월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by