- The "addParameterOverride" function: https://www.mathworks.com/help/releases/R2023b/sltest/ref/sltest.testmanager.parameterset.addparameteroverride.html
- Creating and running tests with MATLAB scripts: https://www.mathworks.com/help/releases/R2023b/sltest/ug/create-and-run-test-cases-with-scripts.html#mw_8833e81d-968f-43d2-85d3-b12563e2a6d
How to import block parameters into a test assessment block
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a Simulink Mask, whick contains some parameters, when I creat a test Harness(sequence and assesment block), It allows me to create test scenarios with inports and outports, however I would also like to include Mask parameters as variables in the test scenario.
댓글 수: 0
채택된 답변
Harimurali
2024년 1월 9일
Hi Kamal,
I understand that you want to include mask parameters as variables in the test harness.
In this case, the mask parameters do not show up in the "Parameter Overrides" section of the "Simulink Test Manager" for a particular test case.
The mask parameters can be programmatically added to the parameter set to be overridden with the help of the "addParameterOverride" MATLAB function. Here is an example MATLAB code to do the same:
% Get test file -- replace 'MyTestSuite' with the .mldatx file
tf = sltest.testmanager.TestFile('\path\to\MyTestFile');
% Get test suite -- replace 'New Test Suite 1' with the name of the test suite
ts = getTestSuiteByName(tf, 'New Test Suite 1');
% Get test case -- replace 'New Test Case 1' with the name of the test case
tc = getTestCaseByName(ts, 'New Test Case 1');
% Add parameter set
ps = addParameterSet(tc, 'Name','Custom Parameter Set');
% Add parameter overrides -- replace 'MyTestModel/Subsystem' with the path to the masked subsystem
po = addParameterOverride(ps, 'gain', 2, 'MyTestModel/Subsystem');
Refer to the following documentation for further information about:
Hope this helps.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Outputs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!