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 日間)
Luigi
Luigi 2017 年 6 月 13 日
回答済み: Donn Shull 2017 年 12 月 16 日
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 Center および File ExchangeManage Design Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by