Saving Simulink Model Programatically also makes a copy of a test harness

조회 수: 6 (최근 30일)
August
August 2024년 6월 21일
댓글: August 2024년 6월 24일
Hello,
I have a simulink model 'original_model' that has 1 test harness associated with it. That harness is saved externally and has the associated *_harnessInfo.xml file with it. The test harness has none of the "Advanced Properties" clicked such as "rebuild harness on open".
I've noticed that when I call
save_system('original_model','new_model')
it automatically generates the test harness for the 'new_model_test_harnessl.slx' and 'new_model_test_harness_harnessInfo.xml' files.
I am wondering:
  1. Is there a setting for the harness I can change to keep this auto generation from happening?
  2. Is there a setting for save_system I can use to keep this from happening?
Thanks for your help!

답변 (1개)

Yash Sharma
Yash Sharma 2024년 6월 24일
Hi,
In order to stop auto generation of test harness you will have to detach the harness form the model, follow the below steps in order to do so:
  1. From the individual harness model, on the Apps tab, under Model Verification, Validation, and Test, click Simulink Test.
  2. In the Harness tab, click Detach and Export.
  3. In the Export Test Harness to Independent Model dialog box, click OK.
  4. In the Save As dialog box, enter a filename for the standalone harness model and click OK.
  5. The harness converts to a standalone model
Converting removes the harness from the main model and breaks the relationship to the main model. If a model has only one harness, its harnessInfo.xml file is deleted. If a model has more than one harness and you delete one of them, the harnessInfo.xml file is updated
Saving the model after detaching the harness should solve your problem.
Take a look at below documentation for more information.
  • Manage Test Harness: https://www.mathworks.com/help/sltest/ug/manage-test-harnesses.html
Hope it helps!
  댓글 수: 1
August
August 2024년 6월 24일
Thanks for the comment! Unfortunately I don't want to break the relationship with the existing harness since I'll be routinely updating and changing 'original_model'.
I'm using a solution that immediatly deletes the generated harness and harnessinfo.xml.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Outputs에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by