- 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
37 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Amish
on 11 Sep 2023
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 Comments
Gregg Smith
on 10 Nov 2023
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
See Also
Categories
Find more on Inputs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!