- Assign Unique Names: Use the Name property for each state, transition, and chart. Make sure each name is unique within its context.
- Maintain a Mapping Table: Keep a table or database that links your unique names or custom attributes to DOORS objects, so you can reliably update or synchronize them after model changes.
- Custom Properties (Recommended for Complex Models): You can use the Stateflow API to add custom properties to states, transitions, etc. For example, you could add a UUID or a DOORS link as a custom attribute.
Stateflow Model Export: How to get consistent Ids for States and Transitions for exporting
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello Matlab Forum
I am in the business of creating an Export from Stateflow to a DOORS module.
Taken me a while to get there, but I am happy with the initial creation.
However, I am having trouble updating the DOORS module after some Model changes.
The models concerned are made up of a number of subsystems. I start my script by loading he top level model, then using a
set_param(hModel, 'SimulationCommand', 'Update') ;
command to load the subsystems. I read that the id property found on all States, Transistions and Charts was unique so I hoped to use this for any updates.
Subsequent testing shows that this cannot be relied upon and it depends on which subsystems you load first and maybe a load of other things to.
I unzipped the slx files and looked into the Stateflow.xml, it appears that an Id is persisted into the file for each State/ transition etc and remains constant through iterations, but this is not the same Id exposed through the Stateflow API.
I want a reliable identifier to use to identify states, transitions etc.
Any ideas on how to get this appreciated!!
Thanks for any help
Richard
0 Kommentare
Antworten (1)
Akanksha
am 29 Aug. 2025 um 8:48
The Stateflow API Id is tricky for tracking elements, since it’s only unique during the current MATLAB session and can change depending on how you load your model. While the Stateflow.xml file inside the .slx archive does store persistent IDs, these aren’t accessible through the Stateflow API or linked to MATLAB objects. So, unfortunately, there’s no direct way to use those XML IDs for reliable tracking in your scripts.
Recommended way around: Use User Defined Unique Names or Tags -
Since neither the API Id nor the XML IDs are suitable for your use case, the best practice is to assign a unique, persistent name or custom property (like a tag or UUID) to each Stateflow element you want to track. This way, you can reliably identify elements across model changes and MATLAB sessions.
This can be achieved :
% Example: Adding a custom attribute to a Stateflow state
st = find(sfroot, '-isa', 'Stateflow.State', 'Name', 'MyState');
st.UserData.DOORS_ID = 'unique-doors-id-1234';
You can then use this custom attribute for mapping and tracking between Stateflow and DOORS.
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Decision Logic finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!