Why does the FIND method of the Stateflow root object have an inconsistent behavior for the Name property in Stateflow 6.1 (R14SP1) as compared to Stateflow 6.0 (R14)?

1 view (last 30 days)
I have a Simulink model with a subsystem named PPModel that contains a Stateflow chart named Chart. The following commands give different results in Stateflow 6.1 (R14SP1) as compared to Stateflow 6.0 (R14).
In Stateflow 6.1 (R14SP1) the Chart variable is returned as empty:
ModelName='errTest';
rt=sfroot;
m=rt.find('-isa','Stateflow.Machine','-and','Name',ModelName)
compName='PPModel/Chart';
chart=m.find('-isa','Stateflow.Chart','-and','Name',compName)
chart =
handle: 0-by-1
In Stateflow 6.0 (R14), with the same code, the chart variable is returned as follows:
chart =
Path: 'errTest/PPModel/Chart'
Id: 18
Machine: [1x1 Stateflow.Machine]
Name: 'PPModel/Chart'
Description: ''
Dirty: 0
Locked: 0
Iced: 0
Document: ''
Tag: []
StateColor: [0 0 0]
StateLabelColor: [0 0 0]
TransitionColor: [0.2902 0.3294 0.6039]
TransitionLabelColor: [0.2902 0.3294 0.6039]
JunctionColor: [0.6824 0.3294 0]
SelectionColor: [1 0 0.5176]
ChartColor: [1 0.9608 0.8824]
ErrorColor: [1 0 0]
Visible: 0
ChartUpdate: 'Inherited'
SampleTime: ''
Debug: [1x1 Stateflow.ChartDebug]
NoCodegenForCustomTargets: 0
ExportChartFunctions: 0
ExecuteAtInitialization: 0
StrongDataTypingWithSimulink: 1
RequirementInfo: ''
EnableBitOps: 0
Editor: [1x1 Stateflow.Editor]

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, please read below for any possible workarounds:
In Stateflow 6.0 (R14) and earlier versions, the Name property of a Stateflow Chart object returned full model path of the chart. This was verified as a bug in Stateflow 6.0 (R14) and earlier versions. This is fixed in Stateflow 6.1 (R14SP1) to return just the name of the chart. The full path is still available from the Path property. This is an intended change in behavior of the Name property.
To be able to receive the same output as in Stateflow 6.0 (R14), please change the code in R14SP1 to the following:
ModelName='errTest';
rt=sfroot;
m=rt.find('-isa','Stateflow.Machine','-and','Name',ModelName)
%*** Note the change in name ***%
compName='Chart';
chart=m.find('-isa','Stateflow.Chart','-and','Name',compName)

More Answers (0)

Categories

Find more on Syntax for States and Transitions in Help Center and File Exchange

Products


Release

R14SP1

Community Treasure Hunt

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

Start Hunting!