MATLAB: Is there a way to initialize the output of a Truth Table block in Stateflow 6.4.1 (R2006a+)

initializestateflowtabletruth

I have a Stateflow chart containing an output variable. In the Model Explorer, I can set the initial value of the variable.
However, if I have a Truth Table block in my model, I cannot set the initial value in the same manner.

Best Answer

The output of the Truth Table is initially set to zero. However, during the first time step it is determined by passing the initial value of the input signal through the truth table equation. The attached screen shots show this in the debugger.
initial_1.jpg shows at time = 0, the data Y1 (i.e. the output of the truth table) is equal to 0. It is declared to this value in the internal initialization code for the truth table. (The image shows that the Scope.Start method is executed because it comes after the StateflowChart.Start method, which contains the initial values of the truth table input and output).
initial_2.jpg shows the results of StateflowChart.Outputs.Major at time = 0. The input has been passed through the truth table and the output has been set to the appropriate value.
There is no way for the user to set the initial value of the output because it is calculated by running the initial value of the truth table input through the truth table.