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

2 visualizaciones (últimos 30 días)
HDT
HDT el 30 de Mayo de 2023
Respondida: Shlok el 11 de Sept. de 2024
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!

Respuestas (1)

Shlok
Shlok el 11 de Sept. de 2024
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.

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by