MATLAB: How to get the initial value of a output variable of a Stateflow chart programmatically

chart;datainitialstateflowvalue

How do I get the initial value of a output variable of a Stateflow chart programmatically?

Best Answer

Below is the typical steps of getting/changing the initial value of an output variable of a Stateflow chart:
>> b_obj = get_param('path/to/chart', 'Object');
>> c_obj = b_obj.find('-isa','Stateflow.Chart');
>> c_data = c_obj.find('-isa','Stateflow.Data');
>> iniValue = c_data(2).Props.InitialValue; % assuming the output is the second data entry
>> c_data(2).Props.InitialValue = '[1 0 2]';