Receiving an expected '='... error when trying to embbed simple C code in matlab2015

Hello everyone, I am trying to run a simulation in simulink using a piece of code in C. I was following This matlab tutorial using matlab function block but although it worked in matlab2023, in 2015r it doesn't. I receive a ...callingDoubleIt_sfun.c:9:9 error: expected '=', ',', ';', 'asm' or '_attribute_' berfore '.' token. My code is directly pasted from matlab tutorial. I trid another simulation with a different code but the result is the same. Anyone knows what is happening or a simple way to run a simple C code that doesn't require all the additional declarations i've found with S functions examples?

답변 (1개)

I think by mistake you have added sourcefile name in "Include custom C code in generated" category instead of "Include list of additional" category. Look at the below image for correct reference.
The documentation you see on the MathWorks website is related to the latest release. If you are working with the older version of MATLAB then it is advisable to refer to the documentation specific to that particular version.
To access the documentation for "Integrate C Code Using the MATLAB Function Block" in MATLAB R2015, kindly execute the following command in your MATLAB R2015 command window:
web(fullfile(docroot,'simulink/ug/incorporate-c-code-using-a-matlab-function-block.html'))
This will provide you with the relevant documentation for your version of MATLAB.

카테고리

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

제품

릴리스

R2015b

질문:

2023년 6월 22일

답변:

2023년 8월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by