- Open MATLAB and load your model.
- Access the test harness object within your model. You can do this by specifying the path to the test harness.
- Now, you can retrieve its UUID using the get_param function
How do I get the harness UUID in Simulink Test
조회 수: 43 (최근 30일)
이전 댓글 표시
When I merge with git, the UUID of my harness gets out of sync with the XML file. How do I get the current UUID of the test harness without needing to reimport my harness?
댓글 수: 0
답변 (1개)
Amish
2023년 9월 11일
Hi Taylor,
As I can understand, you need to find a way to get the current UUID of your test harness without reimporting it.
In Simulink, the Universally Unique Identifier (UUID) of a test harness is typically generated when the test harness is created. If the UUID of your test harness gets out of sync with the XML file, you can retrieve the current UUID of the test harness without needing to reimport it by using the Simulink API and MATLAB scripting.
The general way to do this is as follows:
Here is a sample code for your help:
% Load the Simulink model
load_system('YourModelName');
% Access the test harness
harnessPath = 'YourModelName/MyTestHarness';
harnessObj = Simulink.Harness.getHarness(harnessPath);
% Retrieve the UUID
harnessUUID = get_param(harnessObj, 'UUID');
% Display or use the UUID
disp(['UUID of the test harness: ' harnessUUID]);
For more details, you can refer to the documentation : Create or Import Test Harnesses and Select Properties - MATLAB & Simulink - MathWorks India
Thank you,
Amish
댓글 수: 2
Gregg Smith
2023년 11월 10일
Hi,
I'm not familiar the API given above. I believe the customer should instead use:
% HarnessName - name of the loaded/opened harness block diagram
harnessUUID = get_param(HarnessName, 'HarnessUUID')
If the harness is not opened or loaded, you can access the harness UUID for a give harness name as follows:
% SysName - name of the loaded/opened system block diagram
hInfo = Simulink.harness.find(SysName, 'Name', HarnessName)
There should be a field hInfo.uuid
Thanks
Gregg Smith
Simulink Test Dev
참고 항목
카테고리
Help Center 및 File Exchange에서 Inputs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!