Access model viewmarks and notes programmatically

3 Ansichten (letzte 30 Tage)
Alexander Boll
Alexander Boll am 3 Jun. 2022
Beantwortet: Satwik am 17 Feb. 2025
I would like to access all of a model's viewmarks and notes in an automatic fashion.
For this I would need two pointers:
  1. How to get a list of all viewmarks+notes associated to a model. (find_system seems not to output them)
  2. A list of the parameters of viewmarks (name, associated subsystem, coordinates ...?) and notes (note texts ...) so as to access their content.
If you can only help with one of the two, it would still help :)

Antworten (1)

Satwik
Satwik am 17 Feb. 2025
I believe that viewmarks and notes in Simulink are part of the model annotations. The 'get_param' function along with the 'find_system' function can be used to access the annotation details from the model.
Here is a possible approach to achieve this:
% Load the model
load_system('your_model_name');
% Get all annotations in the model
annotations = find_system('your_model_name', 'FindAll', 'on', 'Type', 'annotation');
% Iterate over annotations to get details
for i = 1:length(annotations)
annotation = annotations(i);
text = get_param(annotation, 'Text');
position = get_param(annotation, 'Position');
% Display or process the annotation details
fprintf('Annotation %d: %s at position [%d, %d]\n', i, text, position(1), position(2));
end
I hope this helps!

Kategorien

Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by