MATLAB Examples

IF Statement

This example shows the use of flow charts in Stateflow® to create C or MATLAB® statements such as the IF - ELSE statement. This particular example shows how you can create a simple IF - ELSE statement in Stateflow. The equivalent statement in MATLAB® is as follows:

if condition <= 20 If_output = condition^2; elseif condition > 20 & condition <= 70 If_output = 50*sin(condition); else If_output = condition; end