Simulink Test Parameter Override with structs
조회 수: 20 (최근 30일)
이전 댓글 표시
I would like to use the paramter Override functionality in Simulink test to modify specific elements of a structure that resides in a datadictionary.
I am able to add the structure to the parameter set in the same way I would add any other parameter but I dont see how I can modify its elements in anyway.
댓글 수: 0
채택된 답변
Jaynik
2023년 12월 26일
Hi Jake,
I understand that you want to modify values of specific elements of a structure that is stored in a data dictionary.
Direct modification is not possible, as the properties of the 'inputParser' class are read-only. Instead, you will need to create a copy of the structure, make the necessary edits, and then assign the new structure back to the parameter set.
Assuming that "p" is a "inputParser" object and "myParam" is the parameter name, you can do the following to change the value of the structure element:
parsedStruct = p.Results.myParam;
parsedStruct.structElement = true;
parse(p,'myParam',parsedStruct);
To modify elements of a "ParameterOverride" object, I assume that you have created a "ParameterSet". You can do the following to change the value of a structure element:
paramSet = testCase.getParameterSets; % testCase is the Simulink Test test case
x = paramSet.addParameterOverride('structVar', myStruct); % myStruct is the structure obtained from the sldd file
x.Value.myStructElement = value; % x.Value will return the structure myStruct
However, this method will not alter the value in the "sldd" file itself. Providing a definitive answer is challenging without a clear understanding of your specific workflow.
Refer to the following link to learn more about "addParameterOverride":
Hope this helps!
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Inputs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!