Can I define a cell class data using data dictionary in Simulink?

7 次查看(过去 30 天)
Dear All,
In Matlab environment, I see that we can define a cell class as below
AAAA_param = cell (1,4);
AAAA_param{1} = uint8(0);
AAAA_param{2} = uint8(1);
AAAA_param{3} = uint8([2 3]);
AAAA_param{4} = uint8(4);
So, How to define AAAA_param by using datadictionary in Simulink?
Thank so much for help!

回答(1 个)

Shlok
Shlok 2024-9-11,8:45
Hi HDT,
I understand that you want to define a cell class in Simulink by using Data Dictionary. To achieve the same, enter the following set of commands in the Command Window:
  • Create a new Data Dictionary (eg: myDictionary) using the command:
>> Simulink.data.dictionary.create('myDictionary.sldd');
  • Open the Data Dictionary to add entries:
>> myDictionary = Simulink.data.dictionary.open('myDictionary.sldd');
  • Get the Design Datasection of the dictionary:
>> dDataSectObj = getSection(myDictionary, 'Design Data');
  • Define the cell array AAAA_param in the Data Dictionary:
>> AAAA_param = {uint8(0), uint8(1), uint8([2 3]), uint8(4)};
>> dDataSectObj.addEntry('AAAA_param', AAAA_param);
  • Save the changes to the Data Dictionary:
>> saveChanges(myDictionary);
This will store the AAAA_param cell array in your Data Dictionary, making it accessible for use in your Simulink models.
To verify if “AAAA_param” is working correctly, link the Data Dictionary to your model (Model Properties > External Data > Data Dictionary) and use the values in a Constant block within your Simulink model.
To know more about Data Dictionary, refer to the following documentation link:
Hope it helps.

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by