www.gusucode.com > simulink 案例源码程序 matlab代码 > simulink/AddEntryToDataDictionaryAndModifyItsValueExample.m

    %% Add Entry to Data Dictionary and Modify its Value
% Represent the Design Data section of the data dictionary |myDictionary_ex_API.sldd| with
% a |Simulink.data.dictionary.Section| object named |dDataSectObj|. 
myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd');
dDataSectObj = getSection(myDictionaryObj,'Design Data');
%%
% Add an entry |myEntry| with value |27| to
% the Design Data section of |myDictionary_ex_API.sldd|.
% Assign the returned |Simulink.data.dictionary.Entry| object
% to variable |e|.
e = addEntry(dDataSectObj,'myEntry',27)
%%
% Change the value of |myEntry| from |27| to
% the character vector |'My New Value'|.
setValue(e,'My New Value')
e