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

1 vue (au cours des 30 derniers jours)
Felipe
Felipe le 22 Juin 2023
Réponse apportée : Keshav le 2 Août 2023
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?

Réponses (1)

Keshav
Keshav le 2 Août 2023
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.

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits


Version

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by