How can i get the Initial Value of an Output signal in a StateFlow ?

3 views (last 30 days)
I want to read the initial value of an output signal in a Stateflow and store it in a variable. I am able to access the object of Data of a Stateflow in the following manner:
SF: is the path of the Stateflow
tmp_SFObj = get_param(SF,'Object')
tmp_ChartObj = tmp_SFObj{1}.find('-isa','Stateflow.Chart')
tmp_SFData = tmp_ChartObj.find('-isa','Stateflow.Data')
But problem arising is that the object 'tmp_SFData' does not have 'Initial Value' as its dataobject variable. How can i get Initial Value of the Output in a variable ??
I am getting following object parameters for an Output signal (No option for Initial Value):
K>> tmp_SFData(1)
ans =
Path: 'xyz'
Id: 690
Machine: [1x1 Stateflow.Machine]
SSIdNumber: 117
Name: 'abc'
Description: ''
SaveToWorkspace: 0
TestPoint: 0
OutputState: []
DataType: 'uint8'
Props: [1x1 Stateflow.DataProps]
ParsedInfo: [1x1 Stateflow.DataParsedInfo]
CompiledSize: ''
CompiledType: 'unknown'
Debug: [1x1 Stateflow.DataDebug]
Tag: []
Document: ''
Scope: 'Output'
Port: 1
InitializeMethod: 'Expression'
UpdateMethod: 'Discrete'
MessageMode: 'NotMessage'
LoggingInfo: [1x1 Stateflow.SigLoggingInfo]
  1 Comment
Sajal Agarwal
Sajal Agarwal on 23 May 2016
Thanks for the views guys... I have got the solution. Syntax:
tmp_SF_Value = tmp_SFData.Props.InitialValue;

Sign in to comment.

Answers (0)

Categories

Find more on Stateflow in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!