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

조회 수: 4 (최근 30일)
Felipe
Felipe 2023년 6월 22일
답변: Keshav 2023년 8월 2일
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개)

Keshav
Keshav 2023년 8월 2일
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.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by