How to retrieve the Inport names/labels of a Stateflow chart?
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Max Heimann
el 13 de En. de 2022
Comentada: Anubhav Routray
el 20 de Abr. de 2023
Hello, I am looking for a way to programatically retrieve the portnames of a stateflow chart.
Curiously get_param(gcb,'OutputSignalNames') returns a cell array of strings with the names of all outports of the chart. However get_param(gcb,'InputSignalNames') returns an empty cell. I tried several other parameters, aswell as analyzing the PortHandles of the chart directly, but without success.
Why does 'InputSignalNames' return a blank cell? Are there certain prerequisites for this parameter to work as expected? Are there alternative parameters?
Is there a possible workaround? E.g. is there an API for the model explorer which would allow me to parse the chart data for variables with "Scope" -> "Input"?
Thank you in advance!
0 comentarios
Respuesta aceptada
Monika Jaskolka
el 18 de En. de 2022
I'm not sure what the InputSignalNames parameter is used for and there is little information about it in the Simulink documentation. It was also empty for me.
Alternatively, you can use the Stateflow API to get the information you are looking for. For example:
openExample('stateflow/ModelingASecuritySystemExample');
chartName = 'Security System';
chart = find(sfroot, '-isa', 'Stateflow.Chart', 'Name', chartName);
inport = find(chart, '-isa', 'Stateflow.Data', 'Scope', 'Input');
inport_name = arrayfun(@(x) x.Name, inport, 'UniformOutput', false)
2 comentarios
Anubhav Routray
el 20 de Abr. de 2023
Hi. I believe this works as Federico mentioned when the names are written on the connections. How would one find the names if the names are not written on the connection lines.?
I tried with the 'stateflow/ModelingASecuritySystemExample' for outports and it gives an empty array.
Más respuestas (1)
Federico
el 14 de Feb. de 2023
'InputSignalNames' contains informations of names on lines connecting inports
1 comentario
Anubhav Routray
el 20 de Abr. de 2023
Yes. You are absolutely correct. Is there any workaround how to get the signal names if the names are not written on the lines connecting the ports.? Appreciate your help
Ver también
Categorías
Más información sobre Graphical Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!