What is the proper syntax to include an enum data type in a Simulink parameter?
Ältere Kommentare anzeigen
I have a Simulink parameter that I've imported to the model workspace and is data type struct. It's going to be used as a bus output from a constant block in the model, outputting a bus that is stored in a data dictionary, and will be used with a Bus Assignment block being sent to the 'bus' input port.
The problem I'm running into is that the bus I want to use contains an enumerated data type. I manually edited my parameter object to include the necessary data, but I don't know what to use here to make it accept an enum. I know that these can store data with multiple dimensions, because I've worked on a similar project where that was done, but I have no reference for how to use an enum.
Input_1 = Simulink.Parameter;
saveVarsTmp{1} = struct;
saveVarsTmp{1}.flag = 0;
saveVarsTmp{1}.data = struct;
saveVarsTmp{1}.data.camAttStd = single(0);
saveVarsTmp{1}.data.camPosStd = single(0);
saveVarsTmp{1}.data.mapStd = single(0);
saveVarsTmp{1}.data.timingJitterStd = single(0);
saveVarsTmp{1}.data.camIntStd = single(0);
saveVarsTmp{1}.data.terrain = single(0); % <--- This value needs proper syntax for type enum
Input_1.Value = saveVarsTmp{1};
Input_1.CoderInfo.StorageClass = 'Auto';
Input_1.CoderInfo.Alias = '';
Input_1.CoderInfo.Alignment = -1;
Input_1.CoderInfo.CustomStorageClass = 'Default';
Input_1.CoderInfo.CustomAttributes.ConcurrentAccess = false;
Input_1.Description = '';
Input_1.DataType = 'Bus: errConfig_IO';
Input_1.Min = [];
Input_1.Max = [];
Input_1.DocUnits = '';
clear saveVarsTmp;
The data named "terrain" is an enum holding about 10 different values, while all other data is just floats. Can anyone help me with the proper syntax here? I have been combing the documentation and have found lots of info for handling enums in different places in Matlab, but never on this format within a Simulink parameter.
Akzeptierte Antwort
Weitere Antworten (1)
ES
am 1 Feb. 2018
0 Stimmen
https://in.mathworks.com/help/simulink/slref/simulink.aliastype.html
Kategorien
Mehr zu Programmatic Model Editing finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
