Imported enum conflict when using Simulink Accelerator
1 view (last 30 days)
Show older comments
I'm using various enumerations in Simulink that are defined externally in a C header file.
For Simulink to use and understand the enumerated data type, I follow these instructions: Import Enumerations Defined Externally to MATLAB.
Below you can see an example of an enumeration:
classdef(Enumeration) BasicColors < Simulink.IntEnumType
enumeration
Red(0)
Yellow(1)
Blue(2)
end
methods (Static = true)
function retVal = getHeaderFile()
retVal = 'enum_list.h';
end
function retVal = getDataScope()
retVal = 'Imported';
end
end
end
This works very well for Normal simulation and code generation. However when I try to run the top level model in Accelerator mode, I see the error "redeclaration of enumerator". I'm using a top level model that contains various model references. If I open the submodel directly, I can run it in Accelerator mode. But it doesn't work when simulating the top-level model. It appears that Simulink is building a new header file for one of the model references "<model_name>_private.h" that contains code that duplicates and conflicts with the externally defined enumeration.
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!