Customize name of code generated called M-FIles
Mostrar comentarios más antiguos
I have a simulink model containing Matlab Function blocks, these ones:

Inside the blocks I have code like this that calls other M-Functions saved in the same folder (this is just a simple example to ilustrate the problem).

My purpose is to generate code from the simulink model, I selected the ert.tlc system target file.
Because I want the called M-Functions (in this example would be the function sec_cuc) to be generated in different C-Files (no code inlining), I enabled the option 'Shared location', as seen in the picture below, which enables all the M-Functions to be saved in the same directory when the code is generated:

After generating the code, the generated files have the name :
knopohdjbiecbaaa_sec_cuc.c knopohdjbiecbaaa_sec_cuc.h (the first part of the names change with the different builds, making the generated code unreliable, they all have names like this with the first part to appear completely random and different from each other)
How can I customize the name or just take out the first part of the name with the random letters? My naming options configuration are:

I appreciate any help! Cheers
Respuestas (3)
Fangjun Jiang
el 1 de Jun. de 2017
0 votos
Right click the block, select "Block Parameters (Subsystem)", select the "Code Generation" panel, For "Function packaging", select "Reusable function", then you can set the "Function name options" and "File name options".
4 comentarios
Marina Moreira
el 1 de Jun. de 2017
Fangjun Jiang
el 1 de Jun. de 2017
Good point. Sorry for missing that.
In that case, I've tried creating a Simulink function at the save level where you have your MATLAB function block.

Inside the Simulink function, use another MATLAB function block.

Inside the MATLAB function block, copy and past the M-script for sec_cuc.m
Then generate the code.

Marina Moreira
el 2 de Jun. de 2017
Aditya Shenoy
el 15 de Jul. de 2018
Me too facing the same Issue of Random name generation. Does any one has the solution for it?
Fabian Stein
el 5 de Abr. de 2018
0 votos
How come no one from Mathworks can help here? This can not really be the intention!?
1 comentario
Andreas Goser
el 13 de Abr. de 2018
Fabian, MATLAB Answers is primarily a user-help-users forum and not a contact method to Technical Support. I saw you have contact support directly and will provide a first answer in a few minutes.
I have the same problem. Did anybody find a good solution to this problem? Still using Matlab 2017a
Categorías
Más información sobre Simulink Coder en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

