How can I control the autocode names for matlab m files?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I think I found the process for controlling the C autocode file/function name for matlab .slx models. However, how do I control the autocode file/function name for matlab .m files?
For example, this simple matlab .m file/function is called: function [Angle_Out] = eml_Wrap_Angle(Angle_In)
When autocoded, it first showed up as:
eml_Wrap_Angle_BYuy7qQF.h & .cpp.
After updating:
cs.set_param('MATLABFcnDesc', 'off');
from off to on to show the matlab comments in the C++ autocode, the name changed to this:
eml_Wrap_angle_hMfilaPR.h & .cpp.
We have some google tests where we use the old file/function names. It would be a lot of work for us to update these names in all the google tests. I would rather not, but if we have to, is it possible to get autocode names without the random name portion added? Or better yet, why did the random name portion change after simply changing the MATLABFcnDesc option? I would not have expected that. That might be a matlab bug.
0 commentaires
Réponses (1)
Himanshu
le 22 Oct 2024
Hey,
Changing code generation settings, such as turning certain features on or off, can influence the internal state and metadata during code generation, potentially resulting in different unique identifiers.
A configuration object allows you to define various settings that affect code generation behavior, including naming conventions. To create a configuration object for code generation, use coder.config.
cfg = coder.config('lib'); % Use 'lib' for library generation, or 'dll', 'exe', etc.
Utilize the CustomSymbolStrFcn property to establish a custom naming pattern for functions, which helps determine how functions are named in the generated code.
matlab
cfg.CustomSymbolStrFcn = 'eml_Wrap_Angle';
Additionally, I recommend using the latest version of MATLAB for code generation. I recently generated code for a function in MATLAB R2024a, and I noticed that the identifiers are not present in the file names. The files are simply named <functionname>.cpp and <functionname>.h.
0 commentaires
Voir également
Catégories
En savoir plus sur Startup and Shutdown 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!