- 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 次查看(过去 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!