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

조회 수: 2 (최근 30일)
HDT
HDT 2023년 5월 30일
답변: Shlok 2024년 9월 11일
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일
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