How to access parameter attributes from data dictionary in Simulink block

Hello,
I am using a data dictionary for my model in Simulink to access parameters. I have defined the parmeter values and its other attributes such as min value and max value etc.
I want to call the min and max values in a simulink block e.g., as constant. I tried to call it as
Param.Min
Unable to resolve the name 'Param.Min'.
and
Param.Max
It shows the value but gives me error while running the model saying "dot value attribution is not supported."
Does anyone know how to access these attributes without redefining them? I am using following code to create my data dictionary.
myDictionaryObj = Simulink.data.dictionary.create('myDictionary.sldd');
myDictionaryObj = Simulink.data.dictionary.open('myDictionary2.sldd');
toolDataSectObj=getSection(myDictionaryObj,'Design Data');
ParameterFile = readtable('test_Param.xlsx');
for i = 1:height(ParameterFile)
param = Simulink.Parameter;
param.Value = ParameterFile.Value(i);
param.Max = ParameterFile.Max(i);
param.Min = ParameterFile.Min(i);
param.Description = char(ParameterFile.Desc(i));
param.Unit = char(ParameterFile.Unit(i));
addEntry(toolDataSectObj, char(ParameterFile.Parameter(i)), param);
end

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2025 年 4 月 14 日

0 投票

By default, Param.Min refers 'Param' as a structure and 'Min' as one of its field.
I've tested it. You can use
Simulink.data.evalinGlobal(bdroot,'Param.Min')
If 'Param' is in base workspace, it would be evalin('base','Param.Min')

4 件のコメント

Anantrao
Anantrao 2025 年 4 月 15 日
Hello,
Thank you for your response. I tried it but it does not work, as shown in fig.
This gives me following error:
Error:Invalid setting in 'untitled/Constant' for parameter 'Value'.
Caused by:
Error evaluating parameter 'Value' in 'untitled/Constant'
Dot indexing is not supported for variables of this type.
So I don't know what I am doing worng?
Fangjun Jiang
Fangjun Jiang 2025 年 4 月 15 日
Need to add two single-quote symbols. 'Param.Min'
Anantrao
Anantrao 2025 年 4 月 17 日
Hello, still does not work!
Fangjun Jiang
Fangjun Jiang 2025 年 4 月 17 日

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeEvent Functions についてさらに検索

製品

リリース

R2023b

質問済み:

2025 年 4 月 14 日

コメント済み:

2025 年 4 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by