Effacer les filtres
Effacer les filtres

How to generate C++ code from a *.fis file?

7 vues (au cours des 30 derniers jours)
Shaun Enoch
Shaun Enoch le 19 Avr 2020
Modifié(e) : Sanju le 30 Avr 2024
How do I generate C++ code from a *.fis file?

Réponses (1)

Sanju
Sanju le 25 Avr 2024
Modifié(e) : Sanju le 30 Avr 2024
To generate C++ code from .fis file, you can follow below steps,
STEP 1: strcture creation and evaluation:
  • Begin by transforming the .fis file into a structured format. Utilize the "readfis" function to load the .fis file and the "getFISCodeGenerationData" function to create the structure. Save this structured data in a separate .m file.
  • Create a new .m file containing a function that takes the structured data as input. Within this function, employ the "evalfis" function to evaluate the .fis file.
  • Incorporate a function call within the initial .m file to invoke this function.
STEP 2: code generation:
  • For generating the code, execute the following command,
>> codegen -lang:c++ code_gen -args {fisStructure} -report
  • Here, we specify C++ as the target language. "code_gen" represents the function name, and "fisStructure" denotes the input for the "code_gen" function. The "-report" option provides a detailed report along with the generated code.
  • once the code generation is successful, the following command will appear on the command window,
>> codegen -lang:c++ code_gen -args {fisStructure} -report
Code generation successful: View report
  • To generate code in C, repeat Step 1 and then open MATLAB Coder directly. Add the function file and the .m file created earlier. The code will be generated in the current MATLAB folder.
I have also attached the sample file I have used for generating the code for your reference!
Note: Make sure to install mingw from Add-on explorer.
You can also refer to the following documentation links for more information,
Hope this helps!

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by