Hi, I would like to implement an algorithm that fill the sldd from a model. The problem is that all the new object added have the default StorageClass Auto. How can I change it from command?

1 次查看(过去 30 天)
Handles_cal=find_system(load_system('name_model'),'MaskPropertyNameString','CAL_BLK_NAME'); for i=1:length(Handles_cal) NAME=get(Handles_cal(i),'CAL_BLK_NAME'); myDictionaryObj = Simulink.data.dictionary.open('name_model.sldd'); sectionObj = myDictionaryObj.getSection('Design Data'); eval(sprintf('%s',[NAME '=Simulink.Parameter;'])) SignalName = Simulink.Parameter; SignalName.Value = 0; SignalName.Description='Description'; entryObj = addEntry(sectionObj,NAME,Simulink.Parameter); end

回答(1 个)

Donn Shull
Donn Shull 2017-12-16
Based on the code from your question you could create the parameters with Storage Class 'Imported Extern' as follows:
Handles_cal=find_system(load_system('name_model'),'MaskPropertyNameString','CAL_BLK_NAME');
myDictionaryObj = Simulink.data.dictionary.open('name_model.sldd');
sectionObj = myDictionaryObj.getSection('Design Data');
for i=1:length(Handles_cal)
NAME=get(Handles_cal(i),'CAL_BLK_NAME');
param = Simulink.Parameter;
param.CoderInfo.StorageClass = 'ImportedExtern';
entryObj = addEntry(sectionObj, NAME, param);
end

类别

Help CenterFile Exchange 中查找有关 Manage Design Data 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by