How do I check if a subsystem handle is for a stateflow chart

15 Ansichten (letzte 30 Tage)
Jamie Wardlaw
Jamie Wardlaw am 26 Nov. 2013
Bearbeitet: Mathieu Leblond am 8 Jun. 2017
Hello,
I am trying to write a script that parses my model identifying all subsystems for subsequent processing/modifications via the script.
However, when I have a handle that actually corresponds to a stateflow chart I need to switch to using the stateflow API but how can I easily check if a subsystem handle is a stateflow chart?
  1 Kommentar
Mathieu Leblond
Mathieu Leblond am 8 Jun. 2017
Bearbeitet: Mathieu Leblond am 8 Jun. 2017
use the parameter : SFBlockType
flgChart = strcmp(get_param(gcs,'SFBlockType'),'Chart');

Melden Sie sich an, um zu kommentieren.

Antworten (3)

jagpreet  makkad
jagpreet makkad am 21 Mai 2015
Bearbeitet: jagpreet makkad am 21 Mai 2015
hi
You can do it by utilizing ErrorFcn callback parameter,for chart its value is 'Stateflow.Translate.translate', may be we can use it to differentiate Stateflow chart.
The better ways to do the same is to find the object of the block
obj=get_param(gcbh,'Object')
then checking it for chart using following command :
tmp_Check= obj.find('-isa','StateFlow.Chart');
if(~isempty(tmp_check))
{
%% Stateflow Chart;
else
%% Simulink object
}

xu ding
xu ding am 22 Aug. 2016
Bearbeitet: xu ding am 22 Aug. 2016
function result = is_subsystem_stateflow(handle_subsystem)
if strcmp(get_param(handle_subsystem, 'BlockType'), 'SubSystem')
obj = get_param(handle_subsystem,'Object');
stateflow = find(obj, '-isa','Stateflow.Chart');
subsystem_path = [get_param(handle_subsystem, 'Parent'), '/', get_param(handle_subsystem, 'Name')];
if (length(stateflow) == 1) && strcmp(stateflow.Path, subsystem_path)
result = true;
else
result = false;
end
else
result = false;
end
end

Guy Rouleau
Guy Rouleau am 27 Nov. 2013
Use the "MaskType" property of the subsystem... it is equal to 'Stateflow' for a Stateflow chart.
  2 Kommentare
Tarun(TJ) Jhamnani
Tarun(TJ) Jhamnani am 10 Jul. 2014
Hello Guy,
I am currently using MATLAB 2014a and recently came to my observation that 'MaskType' property of state-flow block is empty.(Till 2011a it was same what you mentioned in above answer) Is there a new function introduce to differentiate between a normal subsystem and a State flow chart? Can you kindly share the details. Thanks in advance.
Wojciech Przystas
Wojciech Przystas am 30 Sep. 2014
Hi,
I have the same problem: MaskType is empty since R2012b. Is there a Simulink API (get_param) solution available?
Thanks.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Simulink Functions 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!

Translated by