Stateflow Release Notes

R2014b

New Features, Bug Fixes, Compatibility Considerations

Comment-out capability to disable objects in the state diagram

You can now comment out Stateflow objects to exclude the objects from simulation. Use commenting to:

  • Debug a chart by making minor changes between simulation runs.

  • Test and verify the effects of objects on simulation results.

  • Create incremental changes for rapid iterative design.

For more information, see Commenting Stateflow Objects in a Chart.

Window to manage conditional breakpoints and watch chart data

The new Stateflow® Breakpoints and Watch Data window provides easier management of all Stateflow breakpoints and watch data. In the Breakpoints tab, you can:

  • Set conditions on breakpoints.

  • Disable and clear individual breakpoints.

  • View the hit count for breakpoints.

In the Watch Data tab, you can:

  • Watch data at any point in a simulation.

  • View data values in different library instances at the same time.

  • View highlights on data that changed from the last time simulation paused.

This new window replaces the Stateflow Debugger. You now control Stateflow error checking options (Transition Conflict, Data Range, and Detect Cycles) from Simulation > Debug > Stateflow Error Checking Options. For more information, see Manage Stateflow Breakpoints and Watch Data.

Compatibility Considerations

Breakpoints and watch data are no longer stored with the model. The breakpoints and watch data are associated with the MATLAB session. You can save the current list to a file and reload it to another session to restore the list of breakpoints and watch data.

Simulink blocks that create and call functions across Simulink and Stateflow

You can call the new Simulink® Function block from inside Stateflow charts. The new Simulink Caller blocks can also call exported Stateflow functions.

User-controlled enumeration size for active state output

You can now set the storage type and size for enumerations created with active state output. Choose the storage type in Base storage type for automatically created enumerations: under the Optimization > Stateflow pane of the Configuration Parameters dialog box. If you need a smaller memory footprint, use this option.

Faster chart simulation and animation

Lightning Fast animation provides the fastest simulation speed by buffering the highlights. During Lightning Fast animation, the more recently highlighted objects are in a bolder, lighter blue. These highlights fade away as simulation time progresses. For more information, see Animate Stateflow Charts.

Improved state transition matrix

The state transition matrix has traceability of cells to the state transition table. You can interact with the state transition matrix to search and filter states. You can easily view the conditions and events of the state machine. For more information, see View State Reactions with State Transition Matrix.

Active state output not allowed with Initialize Outputs Every Time Chart Wakes Up

Compatibility Considerations

Do not set the chart property Initialize Outputs Every Time Chart Wakes Up on charts that use active state output. The behavior is unpredictable.

R2014a

New Features, Bug Fixes, Compatibility Considerations

Intelligent tab completion in charts

Stateflow provides context-sensitive editing assistance with tab completion. You can quickly select syntax-appropriate options for keywords, data, event, and function names.

Single chart block in Stateflow library with MATLAB as the default action language

In R2014a, there is one Stateflow Chart block that defaults to using MATLAB as the action language. You can modify the action language of a chart to use C syntax. For more information, see Modify the Action Language for a Chart.

Bus signal logging in charts

You can now log bus signals in Stateflow charts.

Output of leaf-state activity to Simulink

In previous releases, you could output self and child activity to Simulink. In R2014a, you can also output leaf-state activity using automatically managed enumerations.

UTF-16 character support for Stateflow blocks

You can use international characters when naming these Stateflow blocks:

  • Charts

  • State Transition Tables

  • Truth Tables

Syntax auto-correction inserts explicit cast for literals

The auto-correction for MATLAB® syntax now inserts explicit casts for literals.

Improved algebraic loop handling in Simulink can affect Stateflow blocks

Compatibility Considerations

A model with a Bus Selector block between two Stateflow exported graphical functions that share the same memory can produce different results.

Typedef generation management for imported buses and enumerations

For MATLAB functions and charts, you can manage generation of typedef definitions for imported bus and enumeration types in the Configuration Parameters dialog box, on the Simulation Target pane. You can choose to provide the typedef definition in a custom header file, or have Simulink generate the definitions.

Updated Search & Replace tool

The Stateflow Search & Replace tool has been updated to simplify the controls and improve the color selection of the interface.

Support of complex data types with data store memory

Stateflow now supports complex data types for use with Data Store Memory.

Streamlined MEX compiler setup and improved troubleshooting

You no longer have to use mex -setup to choose a compiler. mex automatically locates and uses a supported installed compiler. You can use mex -setup to change the default compiler. See Changing Default Compiler.

Moore chart outputs cannot depend on inputs

Compatibility Considerations

In previous versions of Stateflow, in Moore charts that used MATLAB as the action language, you could assign an output that was dependent on an input. This construct violates Moore semantics, and Stateflow now generates a compiler error. For more information, see Design Considerations for Moore Charts.

Transition conflict error checking only on C charts with implicit execution order

Transition Conflict in Error checking options of the Stateflow debugger is only valid for C charts that use implicit transition execution ordering. The debugger does not check transition ordering for charts that use MATLAB as the action language, or C charts with explicit transition ordering.

R2013b

New Features, Bug Fixes

LCC compiler included on Windows 64-bit platform for running simulations

The Windows® 64-bit platform now includes LCC-win64 as the default compiler for running simulations. You no longer have to install a separate compiler for simulation in Stateflow and Simulink. You can run simulations in Accelerator and Rapid Accelerator modes using this compiler.

    Note:   The LCC-win64 compiler is not available as a general compiler for use with the command-line MEX in MATLAB. It is a C compiler only. You cannot use it for SIL/PIL modes.

LCC-win64 is used only when another compiler is not configured in MATLAB. To build MEX files, you must install a compiler. See Supported Compilers.

Tab completion for keywords and data in charts

Press the Tab key for automatic word completion of keywords, data, and function names in charts.

Pattern Wizard for inserting logic patterns into existing flow charts

You can now use the Pattern Wizard to add loop or decision logic to a previously created pattern in a flow chart.

Absolute time temporal logic keywords, msec and usec, for specifying short time intervals

You can now specify milliseconds and microseconds for absolute time temporal logic in charts.

Continuous time support in charts with MATLAB as the action language

Charts that use MATLAB as the action language now support continuous time mode with zero crossing detection.

Content preview for Stateflow charts

When a chart is closed, you can preview the content of Stateflow charts in Simulink. You can see an outline of the contents of a chart. During simulation you can see chart animation. When a chart is open, you can preview the content of subcharts, Simulink functions, and graphical functions. For details, see Content Preview for Stateflow Objects.

For example, the Temporal Logic chart uses content preview, and the Without Temporal Logic chart does not.

Code generation improvement for absolute-time temporal logic in charts with discrete sample times

For charts with discrete sample time that are not inside a triggered or enabled subsystem, absolute-time temporal operators generate improved code. The generated code now uses integer counters to track time instead of the Simulink time counter. This allows more efficient code, as well as enabling this code for use in software-in-the-loop(SIL) and processor-in-the-loop(PIL) simulation modes.

R2013a

New Features, Bug Fixes, Compatibility Considerations

Output of child-state activity to Simulink using automatically managed enumerations

In previous releases, you could output whether or not a state is active by selecting Output state activity in the State properties dialog box. In R2013a, you can now also output to Simulink the child activity of a chart, state, atomic subchart, or State Transition Table as an enumeration.

Masking of Stateflow block to customize appearance, parameters, and documentation

In R2013a, you can mask a chart, Truth Table block, or State Transition Table block directly. In previous releases, you had to place the Stateflow block in a subsystem, and then mask that subsystem.

Compatibility Considerations

In R2013a, MATLAB scripts or functions that rely on the MaskType property of Stateflow blocks need to be updated. For example, get_param(handle_to_SF_block, 'MaskType') now returns an empty value instead of 'Stateflow'. For backward compatibility, using find_system('MaskType','Stateflow') returns all the Stateflow blocks. However, use the Stateflow API instead, as a better practice. See Overview of the Stateflow API. Do not create masks with Mask Type "Stateflow", because the behavior is unpredictable.

Option to parse Stateflow chart to detect syntax errors and unresolved symbols without updating diagram

You can detect unresolved symbols in a chart without updating the diagram or starting simulation. The Stateflow parser can access all required information for detecting unresolved symbols, such as enumerated data types and exported graphical functions from other charts.

Propagation of parameter names to generated code for improved code readability

In previous releases, Stateflow parameters in the generated code were not derived from the parameter names. In R2013a, parameter names appear unchanged in the code, which provides better traceability between the chart and the generated code.

Complex inputs and outputs for exported graphical functions

Exported graphical functions now support inputs and outputs of complex type.

Use of type(data_name) for specifying output data type disallowed for buses

If your chart specifies output data type using the expression type(data_name), you get an error if data_name is of bus type.

Compatibility Considerations

A model created in a previous release might cause an error in R2013a if the chart contains an output with the data type specification type(data_name) if data_name is of bus type.

New and enhanced examples

The following demo has been added in R2013a:

Example...Shows how you can...
sf_traffic_lightsf_traffic_lightModel a traffic light system with active state output.

The following demos have been enhanced in R2013a:

Example...Shows how you can...
sf_aircraftsf_aircraftModel sf_aircraft now uses active state output.

R2012b

New Features, Bug Fixes, Compatibility Considerations

New editor for Stateflow charts and Simulink models with tabbed windows and model browser tree

The new editor unifies Stateflow and Simulink functionality. The Stateflow Editor shares most of the same menu items with the Simulink Editor, and provides the following enhancements:

  • Unified canvas, for editing Stateflow charts and Simulink models in the same window.

  • Tabbed windows, for accessing Stateflow charts in the same context as Simulink models.

  • Model Browser tree, for browsing the complete model hierarchy, including Stateflow charts.

  • Cross-platform consistency, for accessing the same functionality on Windows, UNIX®, and Mac platforms.

Stateflow Editor menu bar changes

Menu bar changes in the new Stateflow Editor are the same as for the new Simulink Editor.

Stateflow Editor context menu changes

All changes for the following three Stateflow Editor context menus are the same as for the new Simulink Editor:

  • From the canvas

  • From a block

  • From a signal

The following sections describe changes to context menus that are specific to Stateflow:

From a chart

R2012a Stateflow Editor Context MenuNew Stateflow Editor Equivalent

Patterns

Add Patterns.

Add Note

Not available from context menu.

From the palette, select the Annotation icon ( ).

Cut

Copy

Not available from context menu.

Use the context menu for an item in the chart that you want to cut or copy.

Back

Forward

Go To Parent

Not available from context menu.

From the menu bar, use View > Navigate.

Execution Order

Not available from context menu.

From the menu bar, use Chart > Parameters.

Font Size

Arrowhead Size

Not available from context menu.

From the menu bar, use Chart > Format.

Format > Align Items

Format > Distribute Items

Format > Resize Items

Not available from context menu.

From the menu bar, use Chart > Arrange.

Fit To View

Not available from context menu.

From the menu bar, use View > Zoom.

Breakpoints

Set Breakpoints on Chart Entry and Clear Breakpoints.

Debug

Not available from context menu.

From the menu bar, use Simulation > Debug.

Find

Not available from context menu.

From the menu bar, use Edit > Find.

Edit Library

Library Link.

From a function

In the R2012a Stateflow Editor, right-clicking a Stateflow function displays the chart context menu. In the new Stateflow Editor, each kind of Stateflow function (for example, graphical function or Truth Table) has its own context menu.

From a transition

In the R2012a Stateflow Editor, right-clicking a Stateflow transition displays the chart context menu. In the new Stateflow Editor, a transition has its own context menu.

There is no longer a Smart menu item. In the R2012a Stateflow Editor, the Smart menu item enabled smart transitions. Smart transitions have ends that slide around the surfaces of states and junctions. When the source and/or destination objects are moved and resized in the chart, these transitions use sliding and other behaviors to enable you to produce an aesthetically pleasing chart. The new Stateflow Editor uses smart transitions all the time.

From a state

In the R2012a Stateflow Editor, right-clicking a Stateflow state displays the chart context menu. In the new Stateflow Editor, a state has its own context menu.

Stateflow keyboard and mouse shortcut changes

The new Simulink Editor and Stateflow Editor use the same navigation shortcuts.

Task R2012a Stateflow Editor ShortcutNew Stateflow Editor Equivalent

Display the parent of the currently displayed chart or subchart.

.. (two periods)

To navigate to the parent, use the up arrow on the toolbar or use the Escape key.

Zoom in by an incremental amount.

+ or r or R

Use mouse scroll wheel or Ctrl++ (the plus sign)

Zoom out by an incremental amount.

- or v or V

Use mouse scroll wheel or Ctrl+- (the minus sign).

Fit chart to screen.

0 or Space Bar

Use Space Bar or from the menu bar, use View > Zoom > Fit To View.

Zoom to normal view.

1

Alt+1

Move the current view down within the full chart.

2

Use the Stateflow Editor scroll bars.

Move the current view down and right within the full chart.

3

Use the Stateflow Editor scroll bars.

Move the current view left within the full chart.

4

Use the Stateflow Editor scroll bars.

Fit the currently selected object to full view. If no object is selected, the chart is fit to full view.

5

Not yet supported

Move the current view right within the full chart.

6

Use the Stateflow Editor scroll bars.

Move the current view up and left within the full chart.

7

Use the Stateflow Editor scroll bars.

Move the current view up within the full chart.

8

Use the Stateflow Editor scroll bars.

Move the current view up and right within the full chart.

9

Use the Stateflow Editor scroll bars.

Editing assistance through smart guides, drag margins, transition indicator lines, and just-in-time error notifications

The new Stateflow Editor makes it easier to create and modify charts by providing these enhancements:

  • Smart guides, for aligning objects interactively as you place them in the chart.

  • Drag margins, which allows all objects within a container to move together. The mouse cursor changes to a double-arrow when you are within the drag margins of an object.

  • Transition indicator lines, for identifying the label associated with a selected transition.

  • Just-in-time error notification, for flagging illegal object placement during editing (for example, when two states overlap).

State transition tables that provide tabular interface to model state machines

A state transition table is an alternative way of expressing modal logic. Instead of drawing states and transitions graphically in a Stateflow chart, you express the modal logic in tabular format. Stateflow automatically generates a graphical state chart from the tabular format, so you can use animation and in-chart debugging (described in In-chart debugging with visual breakpoints and datatips).

Benefits of using state transition tables include:

  • Ease of modeling train-like state machines, where the modal logic involves transitions from one state to its neighbor

  • Concise, compact format for a state machine

  • Reduced maintenance of graphical objects

    When you add or remove states from a chart, you have to rearrange states, transitions, and junctions. When you add or remove states from a state transition table, you do not have to rearrange any graphical objects.

The new block is available in sflib. You can add the block to a new model by entering sfnew('-STT') at the MATLAB command line.

MATLAB language for state and transition labels with chart syntax auto-correction

In R2012b, you can use MATLAB as the action language to program Stateflow charts. Benefits of using MATLAB as the action language include:

  • MATLAB syntax support in state labels and transition labels

    You can use the same MATLAB code that you write in a script or enter at the command line.

  • Automatic identification of unresolved symbols in the new Symbol Wizard

    When you update the diagram or start simulation, the Symbol Wizard provides a list of unresolved data in your chart and infers the scope.

  • Automatic inference of size, type, and complexity for data in the chart, based on usage (unless explicitly defined in the Model Explorer)

  • Support for control flow logic in state labels

    For example, you can write if-else statements directly inside state actions:

    StateA
    du:
    if (x > 0)
      x = x + 1;
    else
      x = x + 2;
    end

    You do not need to create a separate graphical function to define the flow logic.

  • Automatic correction of common syntax errors.

    For example, if you type x++ on a transition segment, the expression is automatically converted to the correct MATLAB syntax, {x=x+1}.

In-chart debugging with visual breakpoints and datatips

In R2012b, the Stateflow debugger includes the following enhancements:

  • Display of data values when hovering over a state or transition

    When you hover over a state or transition, all data values in scope for that object appear in a popup list.

  • Step Over and Step Out options on the debugger

    • When you click Step Over, you can skip the entire execution of a function call when the chart is in debug mode.

    • When you click Step Out, you can skip the rest of the execution for a function call when the chart is in debug mode.

  • Badges on graphical chart objects to indicate breakpoint settings

    • When you hover over the badge on an object, you see a list of breakpoints in a popup list.

    • To modify breakpoint settings, you can click the badge on an object instead of opening the properties dialog box.

Compatibility Considerations

In R2012b, you no longer need to launch the Stateflow debugger to stop chart execution at active breakpoints. Lifting this restriction means that during simulation, chart execution always stops at active breakpoints during simulation, even if the debugger is not running. To prevent unintended interruption of chart execution, Stateflow software automatically disables — but does not delete — existing breakpoints for all objects in charts created in earlier releases. Disabled breakpoints appear as gray badges; you can enable them as needed. See Relationship Between Breakpoints and the Debugger and Set Local Breakpoints.

In addition, in models created in earlier versions, Stateflow software removes When Transition is Tested breakpoints from transitions that do not have conditions. Starting in R2012b, you can set only When Transition is Valid breakpoints on transitions with no conditions.

Reuse of graphical functions with atomic boxes

In R2012b, you can use atomic boxes to reuse graphical functions across multiple charts and models. With atomic boxes, you can reuse models with graphical functions multiple times as referenced blocks in a top model. Because there are no exported graphical functions, you can use more than one instance of that referenced block in the top model.

For more information, see Reusing Functions with an Atomic Box in the Stateflow documentation.

Fewer restrictions for converting states to atomic subcharts

In R2012b, you can convert a state to an atomic subchart when the state accesses chart local data that has any of the following properties:

  • [M N] size, where M and N are parameters that represent the data dimensions

  • One of the following non-built-in data types:

    • Bus type

    • Alias type

    • Fixed-point type of nonzero fraction length, such as fixdt(1,16,3)

In previous releases, conversion of a state to an atomic subchart required that the chart local data have a static, deterministic size and a built-in data type.

Diagnostic for undirected local event broadcasts

In R2012b, you can detect undirected local event broadcasts using a new diagnostic in the Diagnostics > Stateflow pane of the Model Configuration Parameters dialog box. You can set the diagnostic level of Undirected event broadcasts to none, warning, or error.

Undirected local event broadcasts can cause unwanted recursive behavior in a chart and inefficient code generation. You can avoid this behavior by using the send operator to create directed local event broadcasts. For more information, see Guidelines for Avoiding Unwanted Recursion in a Chart and Broadcasting Events to Synchronize States in the Stateflow documentation.

Compatibility Considerations

For new models created in R2012b and existing models created in previous releases, the default diagnostic setting is warning to discourage the use of undirected local event broadcasts. Models that did not warn in previous releases might now issue a warning because the chart contains an undirected local event broadcast.

Diagnostic for transition action specified before condition action

In R2012b, you can detect specified transition actions before specified condition actions in transition paths, using a new diagnostic in the Diagnostics > Stateflow pane of the Model Configuration Parameters dialog box. You can set the diagnostic level of Transition action specified before condition action to none, warning, or error.

In a transition path with multiple transition segments, a specified transition action for a transition segment does not execute until the final destination for the entire transition path becomes valid. A specified condition action for a transition segment executes as soon as the condition becomes true. When a transition with a specified transition action precedes a transition with a specified condition action in the same transition path, the condition action for the succeeding transition might execute before the transition action for the preceding transition. When this diagnostic warns for transition paths containing transition actions specified before condition actions, you can identify out-of-order execution.

For more information, see Transition Action Types and Transitions in the Stateflow documentation.

Compatibility Considerations

In previous releases, the specification of transition actions before condition actions causes an error during simulation. To suppress this error for all models in future MATLAB sessions, use the following command:

sfpref('ignoreUnsafeTransitionActions',1);

In R2012b, the ignoreUnsafeTransitionActions preference does not exist and the default value of the Transition action specified before condition action diagnostic is warning. The warning occurs for all instances of transition actions specified before condition actions, even if you changed the ignoreUnsafeTransitionActions preference in a previous release.

Parentheses to identify function-call output events on chart and truth table block icons

In R2012b, function-call output events appear on Chart and Truth Table block icons with parentheses after the event name. This appearance is consistent with the rendering of input triggers on Function-Call Subsystem block icons.

Resolution of qualified state and data names

The algorithm for resolving a qualified state or data name performs a localized search for states and data that match the given path by looking in each level of the Stateflow hierarchy between the chart level and the parent of the state or data. The algorithm does not perform an exhaustive search of all states and data in the entire chart.

In previous releases, a warning would appear when the search resulted in no matches or multiple matches. In R2012b, this warning has changed to an error. For more information, see Checking State Activity and Using Dot Notation to Identify Data in a Chart in the Stateflow documentation.

Compatibility Considerations

Stateflow charts created in earlier releases now generate an error instead of a warning when the search for a qualified state or data name results in no matches or multiple matches.

Support for simulating charts in a folder that has the # symbol on 32-bit Windows platforms

In R2012b, on 32-bit Windows platforms, you can use the lcc compiler to simulate charts in a folder with the # symbol in its name.

Mac screen menubar enabled when Stateflow is installed

In previous releases, the Mac screen menubar was disabled when Stateflow was installed. This behavior was necessary to enable the Stateflow Editor menu options to work normally on a Mac.

In R2012b, the Mac screen menubar is enabled when Stateflow is installed.

Option to print charts to figure windows no longer available

In R2012b, printing the current view of a chart to a figure window is no longer available.

Compatibility Considerations

To print the current view of a chart, you can send the output directly to a printer or to a file. Available file formats include PS, EPS, JPG, PNG, and TIFF.

End of Broadcast breakpoint no longer available for input events

In R2012b, the option to set a breakpoint at End of Broadcast is no longer available for input events.

Compatibility Considerations

In previous releases, you could set both Start of Broadcast and End of Broadcast breakpoints for input events. Starting in R2012b, Stateflow ignores End of Broadcast breakpoints on input events for existing models.

Boxes can no longer be converted to states

You can no longer convert a Stateflow box object to a state object and vice versa.

Compatibility Considerations

In previous releases, you were able to convert a box object to a state object and vice versa. You must now delete the box or state and replace it with a new box or state with the same name.

R2012a

New Features, Bug Fixes, Compatibility Considerations

API Method for Highlighting Chart Objects

You can use the new highlight method to highlight one of the following objects in a chart:

  • Box

  • State

  • Atomic subchart

  • Transition

  • Junction

  • Graphical function

  • MATLAB function

  • Simulink function

  • Truth table function

For more information, see highlight in the Stateflow API documentation.

API Method for Finding Transitions That Terminate on States, Boxes, or Junctions

You can use the new sinkedTransitions method to find all inner and outer transitions whose destination is a state, box, or junction.

For more information, see sinkedTransitions in the Stateflow API documentation.

API Property That Specifies the Destination Endpoint of a Transition

Transition objects now have a DestinationEndPoint property that describes the location of the transition endpoint at the destination object.

For more information, see Transition Properties in the Stateflow API documentation.

Structures and Enumerated Data Types Supported for Inputs and Outputs of Exported Graphical Functions

In R2012a, inputs and outputs of exported graphical functions can use enumerated data types or structures. For more information, see Rules for Exporting Chart-Level Graphical Functions in the Stateflow documentation.

Mappings Tab in Atomic Subchart Properties Dialog Lists All Valid Scopes

In R2012a, the Mappings tab in the atomic subchart properties dialog lists all valid scopes for data and event mapping. All valid scopes appear, regardless of whether a data or event of that scope exists in the chart.

In previous releases, the Mappings tab listed only the scopes of data and events that existed in the chart and omitted any scope that did not exist. For more information, see Mapping Variables for Atomic Subcharts in the Stateflow documentation.

Full Decision Coverage When Suppressing Default Cases in the Generated Code

In R2011b, selecting Suppress generation of default cases for Stateflow switch statements if unreachable in the Configuration Parameters dialog box would result in decision coverage of less than 100%. In R2012a, you get full decision coverage when suppressing default cases in the generated code for your Stateflow chart.

For more information about decision coverage, see Model Coverage for Stateflow Charts in the Simulink Verification and Validation documentation.

Specification of Custom Header Files in the Configuration Parameters Dialog Box Required for Enumerated Types

If data in your chart uses an enumerated type with a custom header file, include the header information in the Simulation Target > Custom Code pane of the Configuration Parameters dialog box. In the Header file section, add the following statement:

#include "<custom_header_file_for_enum>.h"

Compatibility Considerations

In earlier releases, custom header files for enumerated types did not need to appear in the Configuration Parameters dialog box.

Removal of ‘Use Strong Data Typing with Simulink I/O' in a Future Release

In a future release, the Use Strong Data Typing with Simulink I/O check box will be removed from the Chart properties dialog box because strong data typing will always be enabled.

When this check box is cleared, the chart accepts and outputs only signals of type double. This setting ensures that charts created prior to R11 can interface with Simulink input and output signals without type mismatch errors. For charts created in R11 and newer releases, disabling strong data typing is unnecessary. Also, many Stateflow features do not work when a chart disables strong data typing.

Compatibility Considerations

In R2012a, updating the diagram causes a parse warning to appear when a chart disables strong data typing. To prevent the parse warning, select the Use Strong Data Typing with Simulink I/O check box in the Chart properties dialog box.

R2011b

New Features, Bug Fixes, Compatibility Considerations

Chart Property to Control Saturation for Integer Overflow

A new chart property, Saturate on integer overflow, enables you to control the behavior of data with signed integer types when overflow occurs. The check box appears in the Chart properties dialog box.

Check BoxWhen to Use This SettingOverflow HandlingExample of a Result
SelectedOverflow is possible for data in your chart and you want explicit saturation protection in the generated code.Overflows saturate to either the minimum or maximum value that the data type can represent. An overflow associated with a signed 8-bit integer saturates to –128 or +127.
ClearedYou want to optimize efficiency of the generated code.The behavior depends on the C compiler you use for generating code.The number 130 does not fit in a signed 8-bit integer and wraps to –126.

Arithmetic operations for which you can enable saturation protection are:

  • Unary minus: –a

  • Binary operations: a + b, ab, a * b, a / b, a ^ b

  • Assignment operations: a += b, a= b, a *= b, a /= b

For new charts, this check box is selected by default. When you open charts saved in previous releases, the check box is cleared to maintain backward compatibility.

Enhanced User Interface for Logging Data and States

A new Logging tab on the Data and State properties dialog boxes enables you to log signals in the same way that you do in Simulink. For more information, see Logging Data Values and State Activity in the Stateflow User's Guide.

Control of Default Case Generation for Switch-Case Statements in Generated Code

You can specify whether or not to always generate default cases for switch-case statements. This optimization works on a per-model basis and applies to the code generated for a state that has multiple substates. Use the following check box on the Code Generation > Code Style pane of the Configuration Parameters dialog box:

Check BoxWhen to Use This SettingFormat of Switch-Case Statements
SelectedProvide better code coverage by ensuring that every branch in the generated code is falsifiable.Exclude the default case when it is unreachable.
ClearedEnsure MISRA C® compliance and provide a fallback in case of RAM corruption.Always include a default case.

This readability optimization is available for embedded real-time (ERT) targets and requires a license for Embedded Coder® software. For new models, this check box is cleared by default. When you open models saved in previous releases, the check box is also cleared to maintain backward compatibility.

For more information, see Code Generation Pane: Code Style in the Embedded Coder documentation.

Detection of State Inconsistency Errors at Compile Time Instead of Run Time

In R2011b, you can detect inconsistency errors earlier in the model development process. If you select Edit > Update Diagram in the Simulink Editor, you get an error when Stateflow statically detects that there are no active children during execution of a chart or a state.

Compatibility Considerations

In previous releases, static detection of these inconsistency errors did not occur until run time.

Ability to Model Persistent Output Data for Mealy and Moore Charts

In previous releases, Mealy and Moore charts automatically applied the initial value of outputs every time the chart woke up. Both chart types ensured that outputs did not depend on previous values of outputs by enforcing the chart property Initialize Outputs Every Time Chart Wakes Up.

In R2011b, this restriction has been lifted. You can now choose whether or not to initialize outputs every time a Mealy or Moore chart wakes up. If you disable this chart property, you enable latching of outputs (carrying over output values computed in previous time steps). This enhancement enables you to model persistent output data for Mealy and Moore charts.

Control of Diagnostic for Multiple Unconditional Transitions from One Source

You can control the behavior of the Stateflow diagnostic that detects multiple unconditional transitions from the same state or the same junction. Set Transition shadowing to none, warning, or error on the Diagnostics > Stateflow pane of the Configuration Parameters dialog box.

For more information, see Diagnostics Pane: Stateflow in the Simulink Graphical User Interface documentation.

MEX Compilation with Microsoft Windows SDK 7.1 Now Supported

You can use Microsoft® Windows Software Development Kit (SDK) 7.1 as a MEX compiler for simulation on 32- and 64-bit Windows machines. For a list of supported compilers, see Choosing a Compiler in the Stateflow User's Guide.

Simulation Supported When the Current Folder Is a UNC Path

In R2011b, you can simulate models with Stateflow blocks when the current folder is a UNC path. In previous releases, simulation of those models required that the current folder not be a UNC path.

Removal of the Coverage Tab from the Stateflow Debugger

In R2011b, the Coverage tab of the Stateflow debugger has been removed. In previous releases, clicking the Coverage tab would show the following message:

Coverage feature obsoleted. Please use Simulink Verification and Validation in order to get complete coverage of Simulink/Stateflow objects.

Test Point Selection Moved to the Logging Tab in Properties Dialog Boxes

The Test point check box has moved from the General tab to the Logging tab on State and Data properties dialog boxes.

R2011a

New Features, Bug Fixes, Compatibility Considerations

Migration of Stateflow Coder Features to New Product

In R2011a, all functionality previously available for the Stateflow Coder™ product is now part of the new Simulink Coder product.

Embedded MATLAB Functions Renamed as MATLAB Functions in Stateflow Charts

In R2011a, Embedded MATLAB functions have been renamed as MATLAB functions in Stateflow charts. This name change has the following effects:

  • The function box now shows MATLAB Function instead of eM in the upper-left corner.

  • Traceability comments in the generated code for embedded real-time targets now use MATLAB Function instead of Embedded MATLAB Function.

  • For truth table functions in your chart, the Settings > Language menu now provides Stateflow Classic and MATLAB as the choices.

Scripts that use the Stateflow.EMFunction constructor method continue to work. All properties and methods for this object remain the same.

Use of MATLAB Expressions to Specify Data Size

In R2011a, you can enter MATLAB expressions in the Size field of the Data properties dialog box:

This enhancement enables you to use additional constructs, such as:

  • Variables in the MATLAB base workspace

  • Enumerated values on the MATLAB search path

  • Expressions that use fi objects

For more information, see Sizing Stateflow Data in the Stateflow User's Guide.

Compatibility Considerations

For the Size field, name conflict resolution works differently from previous releases. In R2011a, when multiple variables with identical names exist, the variable with the highest priority is used:

  1. Mask parameters

  2. Model workspace

  3. MATLAB base workspace

  4. Stateflow data

In previous releases, Stateflow data took precedence over all other variables with identical names.

Ability to Change Data Values While Debugging

Previously, you could not change the values of Stateflow data while debugging a chart. Now you can change data values while the chart is in debug mode and see how simulation results change. For more information, see Changing Data Values During Simulation in the Stateflow User's Guide.

Ability to Debug a Single Chart When Multiple Charts Exist in a Model

When Enable debugging/animation is enabled on the Simulation Target pane of the Configuration Parameters dialog box, this setting applies to all charts in your model. In R2011a, you can enable or disable debugging on a chart-by-chart basis, using the Debug menu in the Stateflow Editor:

This enhancement enables you to focus on debugging a single chart, instead of having to debug all charts in the model. For details, see How to Enable Debugging for Charts in the Stateflow User's Guide.

You can also clear all breakpoints for a specific chart by selecting Debug > Clear All Breakpoints in the Stateflow Editor. For more information, see Clearing All Breakpoints in the Stateflow User's Guide.

In previous releases, you could open the debugger by selecting Tools > Debug in the Stateflow Editor. In R2011a, this menu option has moved to Debug > Stateflow Debugger.

Support for Input Events in Atomic Subcharts

In R2011a, you can use input events in atomic subcharts. For more information, see Making States Reusable with Atomic Subcharts in the Stateflow User's Guide.

Control of Generated Function Names for Atomic Subcharts

In R2011a, the generated function names for atomic subcharts follow the identifier naming rules for subsystem methods on the Code Generation > Symbols pane of the Configuration Parameters dialog box:

This enhancement enables you to control the format of generated function names for atomic subcharts when building an embedded real-time (ERT) target. For more information, see Generating Reusable Code for Unit Testing in the Stateflow User's Guide.

Enhanced Data Sorting in the Stateflow Debugger

In previous releases, the Stateflow debugger sorted data by scope first, before alphabetically listing data. In R2011a, the debugger sorts data alphabetically in the Browse Data section, without regard to scope. This enhancement helps you find specific data quickly when your chart contains many variables, for example, over a hundred.

Data sorting depends solely on the variable name and not on hierarchy. For example, if you have chart-parented data named arrayOut and state-parented data named arrayData, the list that appears in the Browse Data section is:

S.arrayData
arrayOut

The state name has no effect on data sorting.

Option to Maintain Highlighting of Active States After Simulation

In R2011a, you can highlight the states that are active at the end of a simulation by selecting Maintain Highlighting in the Stateflow debugger.

This enhancement enables you to inspect the active states of a chart after simulation ends, without having to use the SimState method highlightActiveStates. For more information, see Animating Stateflow Charts in the Stateflow User's Guide.

Right-Click Options for Setting Local Breakpoints

For graphical chart objects, you can now right-click the object to set local breakpoints. This enhancement enables you to set breakpoints more quickly, without having to open the properties dialog box for:

  • Charts

  • States

  • Transitions

  • Graphical functions

  • Truth table functions

For more information, see Setting Local Breakpoints in the Stateflow User's Guide.

New Signal Logging Format That Simplifies Access to States and Local Data

You can now select a format for signal logging data. Use the Signal logging format parameter on the Data Import/Export pane of the Configuration Parameters dialog box to specify the format:

  • ModelDataLogsSimulink.ModelDataLogs format (the default; before R2011a, it was the only supported format)

  • DatasetSimulink.Simulation.Dataset format (new in R2011a)

The Dataset format:

  • Supports logging multiple data values for a given time step, which enhances signal logging of Stateflow data

  • Uses MATLAB timeseries objects to store logged data (rather than Simulink.Timeseries and Simulink.TsArray objects), which enables you to work with logged data in MATLAB without a Simulink license

  • Avoids the limitations of the ModelDataLogs format, which Bug Report 495436 describes

For more information, see Logging Data Values and State Activity.

Compatibility Considerations

In previous releases, selecting Enable debugging/animation on the Simulation Target pane of the Configuration Parameters dialog box would implicitly set all data and states in a Stateflow chart to be test points. In R2011a, you must select the Test point check box explicitly for data and states to appear in the Signal Selector dialog box of a Scope or Floating Scope block.

If you load models from previous releases that rely on the implicit behavior, mark the appropriate data or states as test points to ensure that they appear in the Signal Selector dialog box. For more information, see Monitoring Test Points in Stateflow Charts in the Stateflow User's Guide.

Support for Buses in Data Store Memory

You can now use buses, but not arrays of buses, as shared data in Stateflow data store memory.

Enhanced Readability of State Functions

In R2011a, state functions are more readable due to improved inlining heuristics.

Support for Arrays of Buses as Inputs and Outputs of Charts and Functions

In R2011a, you can pass arrays of buses as inputs and outputs of the following Stateflow objects:

  • Charts

  • MATLAB functions

  • Simulink functions

Default Setting of 'States When Enabling' Chart Property Now Held

For new charts, the default setting of the States When Enabling chart property is Held. In previous releases, the default setting was Inherit. For more information, see Controlling States When Function-Call Inputs Reenable Charts in the Stateflow User's Guide.

Initial Value Vectors with Fixed-Point or Enumerated Values Now Evaluate Correctly

In previous releases, if you set an initial value vector using fixed-point or enumerated values, all elements of that vector would have the same value as the first element. For example:

For this initial value vector...The chart used these values...
[fi(1,1,16,0) fi(2,1,16,0)][1 1], instead of [1 2]
[Colors.Red Colors.Yellow Colors.Green][Colors.Red Colors.Red Colors.Red], instead of [Colors.Red Colors.Yellow Colors.Green]

In R2011a, this bug has been fixed.

Compatibility Considerations

If you have any models that rely on the behavior of initial value vectors from previous releases, these models will behave differently in R2011a.

Mac Screen Menubar Disabled When Stateflow Is Installed

In R2011a, the Mac screen menubar is disabled when Stateflow is installed. This behavior enables Stateflow Editor menu options to work normally on a Mac.

To enable the Mac screen menubar, modify the java.opts file by adding the following line:

-Dapple.laf.useScreenMenuBar=true

To prevent a slowdown in the MATLAB Editor, check that the java.opts file contains the following line:

-Dapple.awt.graphics.UseQuartz=true 

A java.opts file can reside in the folder from which you launch MATLAB or in the bin/maci64 subfolder within the MATLAB root folder. A java.opts file in the latter location applies to all users, but individual users might not have permissions to modify a java.opts file there. If there is a java.opts file in both locations with settings that conflict, the setting in the java.opts file in the folder from which you launch MATLAB takes precedence. You might want to check both locations to see whether you have existing java.opts files and then decide which one to modify.

  • To create a new java.opts file or modify an existing copy in the folder from which you launch MATLAB:

    1. Quit MATLAB.

    2. Relaunch MATLAB and immediately enter the following line in the Command Window:

      edit java.opts
  • To create or modify a java.opts file that applies to all users, you can enter the following line in the MATLAB Command Window at any time:

    edit(fullfile(matlabroot,'bin','maci64','java.opts'))

R2010bSP2

Bug Fixes

R2010bSP1

Bug Fixes

R2010b

New Features, Bug Fixes, Compatibility Considerations

New Atomic Subcharts to Create Reusable States for Large-Scale Modeling

In R2010b, you can use atomic subcharts to:

  • Break up a chart into standalone parts to facilitate team development

  • Reuse states across multiple charts and models

  • Animate and debug multiple charts side-by-side during simulation

  • Use simulation to test changes, one-by-one, without recompiling the entire chart

  • Generate reusable code for specific states or subcharts to enhance unit testing

A video demovideo demo is available to show you how to reuse the same state multiple times in a chart.

Stateflow Library Charts Now Support Instances with Different Data Sizes, Types, and Complexities

In R2010b, you can use library link charts that specify different data sizes, types, and complexities. Previously, all library charts had to use the same settings for data size, type, and complexity. For more information, see Creating Specialized Chart Libraries for Large-Scale Modeling in the Stateflow User's Guide.

Support for Controlling Stateflow Diagnostics in the Configuration Parameters Dialog Box

In R2010b, you can control the behavior of the following Stateflow diagnostics in the Diagnostics > Stateflow pane of the Configuration Parameters dialog box:

  • Unused data and events

  • Unexpected backtracking

  • Invalid input data access in chart initialization

  • No unconditional default transitions

  • Transition outside natural parent

Enhanced Custom-Code Parsing to Improve Reporting of Unresolved Symbols

In R2010b, you can resolve symbols in your chart to symbols defined in custom code while parsing the chart. This enhancement enables more accurate and earlier reporting of unresolved symbols. Previously, the parser assumed that any unresolved chart symbols were defined in custom code. You could not resolve chart symbols to symbols in your custom code until make time. If the chart symbols were undefined in the custom code, a make error would appear.

Also, the Symbol Autocreation Wizard was previously available only for 32-bit Windows platforms that use lcc for the mex compiler. In R2010b, the Symbol Autocreation Wizard is available to help you fix unresolved symbols, regardless of the compiler or platform.

To enable or disable custom-code parsing, you can use the Parse custom code symbols check box on the Simulation Target > Custom Code pane of the Configuration Parameters dialog box.

For more information, see:

Temporal Logic Conditions Can Now Guard Transitions Originating from Junctions

Previously, you could not use temporal logic conditions on transitions that originated from junctions. Now you can use temporal logic conditions on transitions from junctions as long as the full transition path connects two states. For more information, see Rules for Using Temporal Logic Operators and Example of Detecting Elapsed Time in the Stateflow User's Guide.

Data Dialog Box Enhancements

In R2010b, the following changes to the Data properties dialog box apply:

ParametersLocation in R2010aLocation in R2010bBenefit of Location Change
  • Initial value

  • Minimum

  • Maximum

Value Attributes tabGeneral tabConsistent with blocks in the Simulink library that specify these parameters on the same tab as the data type.
  • Test point

  • Watch in debugger

Value Attributes tabGeneral tabIncreases visibility of commonly used parameters.
  • Save final value to base workspace

  • First index

  • Units

Value Attributes tabDescription tabConsolidates parameters related to the data description.

Branching of Function-Call Output Events No Longer Requires Binding of Event to a State

Previously, using a Function-Call Split block to branch a function-call output event from a chart to separate subsystems required binding of the event to a state. In R2010b, binding is no longer required.

Passing Real Values to Function Inputs of Complex Type Disallowed

In R2010b, you cannot pass real values to function inputs of complex type. This restriction applies to the following types of chart functions:

  • Graphical functions

  • Truth table functions

  • Embedded MATLAB® functions

  • Simulink functions

Compatibility Considerations

If you have existing models that pass real values to function inputs of complex type, an error now appears when you try to simulate your model.

Using Chart Block That Accesses Global Data in For Each Subsystem Disallowed

In R2010b, the following model configuration produces an error during Real-Time Workshop® code generation:

New and Enhanced Demos

The following demos have been added in R2010b:

Demo...Shows how you can...
sf_atomic_sensor_pairsf_atomic_sensor_pairModel a redundant sensor pair using atomic subcharts
sf_electrohydraulicsf_electrohydraulicModel a servo mechanism for use in electrohydraulic systems

The following demo has been enhanced in R2010b:

Demo...Now...
sf_elevatorsf_elevatorModels an elevator system with two identical lifts using atomic subcharts

R2010a

New Features, Bug Fixes, Compatibility Considerations

Support for Combining Actions in State Labels

You can now combine entry, during, and exit actions in a single line on state labels. This concise syntax provides enhanced readability for your chart and helps eliminate redundant code. For more information, see Combining State Actions to Eliminate Redundant Code in the Stateflow User's Guide.

New Diagnostic Detects Unused Data and Events

A new diagnostic now detects unused Stateflow data and events during simulation. A warning message appears, alerting you to data and events that you can remove. This enhancement helps you reduce the size of your model by removing objects that have no effect on simulation.

This diagnostic checks for usage of Stateflow data, except for the following types:

  • Machine-parented data

  • Inputs and outputs of Embedded MATLAB functions

This diagnostic checks for usage of Stateflow events, except for the following type:

  • Input events

Enhanced Support for Variable-Size Chart Inputs and Outputs

You can explicitly pass variable-size chart inputs and outputs as inputs and outputs of the following functions:

  • Embedded MATLAB functions

  • Simulink functions

  • Truth table functions that use Embedded MATLAB action language

Support for Chart-Level Data with Fixed-Point Word Lengths Up to 128 Bits

Chart-level data now support up to 128 bits of fixed-point precision for the following scopes:

  • Input

  • Output

  • Parameter

  • Data Store Memory

This increase in maximum precision from 32 to 128 bits provides these enhancements:

  • Supports generating efficient code for targets with non-standard word sizes

  • Allows charts to work with large fixed-point signals

You can explicitly pass chart-level data with these fixed-point word lengths as inputs and outputs of the following functions:

  • Embedded MATLAB functions

  • Simulink functions

  • Truth table functions that use Embedded MATLAB action language

New 'States When Enabling' Property for Charts with Function-Call Input Events

The new chart property States When Enabling helps you specify how states behave when a function-call input event reenables a chart. You can select one of the following settings in the Chart properties dialog box:

  • Held — Maintain most recent values of the states.

  • Reset — Revert to the initial conditions of the states.

  • Inherit — Inherit this setting from the parent subsystem.

This enhancement helps you more accurately control the behavior of a chart with a function-call input event. For more information, see Controlling States When Function-Call Inputs Reenable Charts and Setting Properties for a Single Chart in the Stateflow User's Guide.

Support for Tunable Structures of Parameter Scope in Charts

You can now define structures of parameter scope that are tunable. For more information, see Defining Structures of Parameter Scope in the Stateflow User's Guide.

Enhanced Real-Time Workshop Code Generation for Noninlined State Functions

If you prevent inlining for a state, Real-Time Workshop® generated code contains a new static function inner_default_statename when:

  • Your chart contains a flow graph where an inner transition and default transition reach the same junction inside a state.

  • This flow graph is complex enough to exceed the inlining threshold.

Enhanced Real-Time Workshop Code Generation for sizeof Function

When you use the sizeof function in generated code to determine vector or matrix dimensions, sizeof always takes an input argument that evaluates to a data type.

Behavior in Prior ReleasesBehavior in R2010aBenefits of Change in Code

Input argument references the address of the variable, for example:

sizeof(&a[0])

Input argument evaluates to the data type of the variable, for example:

sizeof(uint8_T [256])

Ensures consistent results between simulation and code generation.

Enhanced Real-Time Workshop Code Generation for Custom-Code Function Calls

When you use custom-code function calls in generated code, vector and matrix input arguments always use pass-by-reference instead of pass-by-value behavior.

Behavior in Prior ReleasesBehavior in R2010aBenefits of Change in Code

Custom-code function calls might use either pass-by-reference or pass-by-value.

For pass-by-value, a memcpy operation creates and stores a temporary variable in the generated code, for example:

int t[10];
for (i=0; i<10; i++) {
t[i] = y[i];
}
fcn(t);

Custom-code function calls use pass-by-reference, for example:

fcn(&y[0]);
  • Ensures consistent results between simulation and code generation.

  • Less memory usage because a temporary variable is not necessary.

  • Faster execution of generated code because a memcpy operation is not necessary.

Data Change Implicit Event No Longer Supports Machine-Parented Data

The implicit event change(data_name) no longer works for machine-parented data. In R2010a, this implicit event works only with data at the chart level or lower in the hierarchy.

Compatibility Considerations

For machine-parented data, consider using change detection operators to determine when data values change. For more information, see Detecting Changes in Data Values in the Stateflow User's Guide.

Support for Machine-Parented Events Completely Removed

Support for machine-parented events has been completely removed. In R2010a, an error message appears when you try to simulate models that contain events at the machine level.

Compatibility Considerations

To prevent undesired behavior for simulation and code generation, do not use machine-parented events. For simulation, broadcasting an event to all charts in your model causes the following to occur:

  • Charts wake up without regard to data dependencies.

  • Charts that are disabled might wake up.

  • Charts that use function-call or edge-triggered events wake up.

  • Charts unrelated to the event wake up.

  • Infinite recursive cycles can occur because the chart that broadcasts the event wakes up.

For code generation, machine-parented events prevent code reuse for the entire model.

MEX Compilation with Microsoft Visual Studio .NET 2003 No Longer Supported

Support for Microsoft Visual Studio® .NET 2003 as a MEX compiler for simulation has been removed because MATLAB and Simulink no longer support this compiler. For information about alternative compilers, see Choosing a Compiler in the Stateflow User's Guide.

Code Generation Status Messages No Longer Shown in Command Window

For Windows platforms, messages about Stateflow or Embedded MATLAB code generation and compilation status now appear only on the status bar of the Simulink Model Editor when you update diagram. Previously, these messages also appeared in the MATLAB Command Window. This enhancement minimizes distracting messages at the command prompt.

Change in Behavior for Appearance of Optimization Parameters

Previously, the Configuration Parameters dialog box showed the Stateflow section of the Optimization pane only when both of the following conditions were true:

  • Real-Time Workshop and Stateflow licenses were available.

  • Your model included Stateflow charts or Embedded MATLAB Function blocks.

In R2010a, the Configuration Parameters dialog box shows the Stateflow section of the Optimization pane when both licenses are available. Your model need not include any Stateflow charts or Embedded MATLAB Function blocks.

For a list of optimization parameters, see Optimization Pane: General in the Simulink Graphical User Interface.

Enhanced Inlining of Generated Code That Calls Subfunctions

In R2010a, Real-Time Workshop Embedded Coder™ software inlines generated code for Stateflow charts, even if the generated code calls a subfunction that accesses global Simulink data. This optimization uses less RAM and ROM.

Check Box for 'Treat as atomic unit' Now Always Selected

In existing models, simulation and code generation of Stateflow charts and Truth Table blocks always behave as if the Treat as atomic unit check box in the Subsystem Parameters dialog box is selected. Starting in R2010a, this check box is always selected for consistency with existing behavior.

New Demos

The following demos have been added in R2010a:

Demo...Shows how you can...
sf_combined_state_actionssf_combined_state_actionsCombine entry and during actions in a single line on state labels
sf_variable_size_datasf_variable_size_dataPass variable-size data as an output of a Simulink function in a Stateflow chart
sf_multiword_fixptsf_multiword_fixptPass multiword fixed-point data as an input and an output of a Simulink function in a Stateflow chart

R2009bSP1

Bug Fixes

R2009b

New Features, Bug Fixes, Compatibility Considerations

Ability to Copy Simulink Function-Call Subsystems and Paste in Stateflow Editor as Simulink Functions, and Vice Versa

You can copy a function-call subsystem from a model and paste directly in the Stateflow Editor. This enhancement eliminates the steps of manually creating a Simulink function in your chart and pasting the contents of the subsystem into the new function. You can also copy a Simulink function from a chart and paste directly in a model as a function-call subsystem.

Ability to Generate Switch-Case Statements for Flow Graphs and Embedded MATLAB Functions Using Real-Time Workshop Embedded Coder Software

If a flow graph or Embedded MATLAB function in your chart uses if-elseif-else decision logic, you can choose to generate switch-case statements during Real-Time Workshop Embedded Coder code generation. Switch-case statements provide more readable and efficient code than if-elseif-else statements when multiple decision branches are possible.

When you load models created in R2009a and earlier, this optimization is off to maintain backward compatibility. In previous versions, if-elseif-else logic appeared unchanged in generated code.

For more information, see:

Support for Creating Switch-Case Flow Graphs Using the Pattern Wizard

In the Pattern Wizard, you can now choose to create a flow graph with switch-case decision logic. For more information, see Modeling Logic Patterns and Iterative Loops Using Flow Graphs in the Stateflow User's Guide.

Support for Using More Than 254 Events in a Chart

You can now use more than 254 events in a chart. The previous limit of 254 events no longer applies. This enhancement supports large-scale models with charts that send and receive hundreds of events during simulation. Although Stateflow software does not limit the number of events, the underlying C compiler enforces a theoretical limit of (2^31)-1 events for the generated code.

For more information, see Defining Events in the Stateflow User's Guide.

Improved Panning and Selection of States and Transitions When Using Stateflow Debugger

During single-step mode, the Stateflow Debugger no longer zooms automatically to the chart object that is executing. Instead, the debugger opens the subviewer that contains that object. This enhancement minimizes visual disruptions as you step through your analysis of a simulation.

Stateflow Compilation Status Added to Progress Indicator on Simulink Status Bar

For Windows platforms, messages about Stateflow compilation status now appear on the status bar of the Simulink Model Editor when you update diagram.

Support for Chart Inputs and Outputs That Vary in Dimension During Simulation

Charts now support input and output data that vary in dimension during simulation. In this release, only Embedded MATLAB functions nested in the charts can manipulate these input and output data.

New Compilation Report for Embedded MATLAB Functions in Stateflow Charts

The new compilation report provides compile-time type information for the variables and expressions in your Embedded MATLAB functions. This information helps you find the sources of error messages and understand type propagation issues, particularly for fixed-point data types. For more information, see Working with MATLAB Function Reports in the Simulink User's Guide.

Compatibility Considerations

The new compilation report is not supported by the MATLAB internal browser on Sun™ Solaris™ 64-bit platforms. To view the compilation report on Sun Solaris 64-bit platforms, you must have your MATLAB Web preferences configured to use an external browser, for example, Mozilla® Firefox®. To learn how to configure your MATLAB Web preferences, see Web Preferences in the MATLAB documentation.

Enhanced Support for Replacing Math Functions with Target-Specific Implementations

You can now replace the following math functions with target-specific implementations:

FunctionData Type Support
atan2Floating-point
fmodFloating-point
ldexpFloating-point
maxFloating-point and integer
minFloating-point and integer

Replacement of abs now works for both floating-point and integer arguments. Previously, replacement of abs with a target function worked only for floating-point arguments.

For more information about Target Function Libraries, see:

Enhanced Context Menu Support for Adding Flow Graph Patterns to Charts

In a chart, you can now right-click at any level of the hierarchy (for example, states and subcharts) to insert flow graphs using the Patterns context menu. Previously, options in this context menu were available only if you right-clicked at the chart level.

Option to Log Chart Signals Available in the Stateflow Editor

To log chart signals, you can select Tools > Log Chart Signals in the Stateflow Editor. Previously, you had to right-click the Stateflow block in the Model Editor to open the Signal Logging dialog box.

Default Precision Set to Double for Calls to C Math Functions

When you call C math functions, such as sin, exp, or pow, double precision applies unless the first input argument is explicitly single precision. For example, if you call the sin function with an integer argument, a cast of the input argument to a floating-point number of type double replaces the original argument. This behavior ensures consistent results between Simulink blocks and Stateflow charts for calls to C math functions.

To force a call to a single-precision version of a C math function, you must explicitly cast the function argument using the single cast operator. This method works only when a single-precision version of the function exists in the selected Target Function Library as it would in the 'C99 (ISO)' Target Function Library. For more information, see Calling C Functions in Actions and Type Cast Operations in the Stateflow User's Guide.

Change in Text and Visibility of Parameter Prompt for Easier Use with Fixed-Point Advisor and Fixed-Point Tool

In the Data properties dialog box, the Lock output scaling against changes by the autoscaling tool check box is now Lock data type setting against changes by the fixed-point tools. Previously, this check box was visible only if you entered an expression or a fixed-point data type, such as fixdt(1,16,0). This check box is now visible for any data type specification. This enhancement enables you to lock the current data type settings on the dialog box against changes that the Fixed-Point Advisor or Fixed-Point Tool chooses.

Charts Closed By Default When Opening Models Saved in Formats of Earlier Versions

If you save a model with Stateflow charts in the format of an earlier version, the charts appear closed when you open the new MDL-file.

New and Enhanced Demos

The following demo has been added in R2009b:

Demo...Shows how you can...
sf_aircraftsf_aircraftDesign a fault detection, isolation, and recovery (FDIR) application for a pair of aircraft elevators with redundant actuators

The following demo has been enhanced in R2009b:

Demo...Now...
sldemo_fuelsyssldemo_fuelsysUses enumerated data types and Simulink functions in the Stateflow chart to model control logic for the fuel rate control system

R2009a

New Features, Bug Fixes, Compatibility Considerations

Support for Saving the Complete Simulation State at a Specific Time

You can save the complete simulation state at a specific time and then load that state for further simulation. This enhancement provides these benefits:

  • Enables running isolated segments of a simulation without starting from time t = 0, which saves time

  • Enables testing of the same chart configuration with different settings

  • Enables testing of hard-to-reach chart configurations by loading a specific simulation state

Enhanced Support for Enumerated Data Types

In R2009a, you can use enumerated data in Embedded MATLAB functions, truth table functions that use Embedded MATLAB action language, and Truth Table blocks. See Using Enumerated Data in Stateflow Charts in the Stateflow User's Guide.

New Boolean Keywords in Stateflow Action Language

You can now use true and false as Boolean keywords in Stateflow action language. For more information, see Supported Symbols in Actions in the Stateflow User's Guide.

Enhanced Control of Inlining State Functions in Generated Code

In R2009a, a new Function Inline Option parameter is available in the State properties dialog box. This parameter enables better control of inlining state functions in generated code, which provides these benefits:

  • Prevents small changes to a model from causing major changes to the structure of generated code

  • Enables easier manual inspection of generated code, because of a one-to-one mapping between the code and the model

New Diagnostic to Detect Unintended Backtracking Behavior in Flow Graphs

A new diagnostic detects unintended backtracking behavior in flow graphs during simulation. A warning message appears, with suggestions on how to fix the flow graph to prevent unintended backtracking. For more information, see Best Practices for Creating Flow Graphs in the Stateflow User's Guide.

Use of Basic Linear Algebra Subprograms (BLAS) Libraries for Speed

Embedded MATLAB functions in Stateflow charts can now use BLAS libraries to speed up low-level matrix operations during simulation. For more information, see Simulation Target Pane: General in the Simulink documentation.

Enhanced Support for Replacing C Math Functions with Target-Specific Implementations

You can now replace the pow function with a target-specific implementation. For more information about Target Function Libraries, see:

Smart Transitions Now Prefer Straight Lines

In R2009a, the graphical behavior of smart transitions has been enhanced as follows:

  • Smart transitions maintain straight lines between states and junctions whenever possible. Previously, smart transitions would preserve curved lines.

  • When you drag a smart transition radially around a junction, the end on the junction follows the tip to maintain a straight line by default. Previously, the end on the junction would maintain its original location and not follow the tip of the transition.

For more information, see What Smart Transitions Do in the Stateflow User's Guide.

Clicking Up-Arrow Button in the Stateflow Editor Closes Top-Level Chart

When a top-level chart appears in the Stateflow Editor, clicking the up-arrow button in the toolbar causes the chart to close and the Simulink model that contains the chart to appear. This behavior is consistent with clicking the up-arrow button in the toolbar of a Simulink subsystem window.

Previously, clicking the up-arrow button for a top-level chart would cause the Simulink model to appear, but the chart would not close. For more information, see Navigating Subcharts in the Stateflow User's Guide.

Enhanced Type Resolution for Symbols

In R2009a, type resolution for Stateflow data has been enhanced to support any MATLAB expression that evaluates to a type.

Enhanced Code Generation for Stateflow Events

In R2009a, the generated code for managing Stateflow events uses a deterministic numbering method. This enhancement minimizes unnecessary differences in the generated code for charts between R2009a and any future release.

Enhanced Real-Time Workshop Generated Code for Charts with Simulink Functions

In R2009a, Real-Time Workshop generated code for charts with Simulink functions no longer uses unneeded global variables for the function inputs and outputs. The interface can be represented by local temporary variables or completely eliminated by optimizations, such as expression folding. This enhancement provides reduced RAM consumption and faster execution time.

Use of en, du, ex, entry, during, and exit for Data and Event Names Being Disallowed in a Future Version

In a future version of Stateflow software, use of en, du, ex, entry, during, or exit for naming data or events will be disallowed. In R2009a, a warning message appears when you run a model that contains any of these keywords as the names of data or events.

Compatibility Considerations

To avoid warning messages, rename any data or event that uses en, du, ex, entry, during, or exit as an identifier.

Support for Machine-Parented Events Being Removed in a Future Version

In a future version of Stateflow software, support for machine-parented events will be removed. In R2009a, a warning message appears when you simulate models that contain events at the machine level.

Compatibility Considerations

To prevent undesired behavior for simulation and code generation, do not use machine-parented events. For simulation, broadcasting an event to all charts in your model causes the following to occur:

  • Charts wake up without regard to data dependencies.

  • Charts that are disabled might wake up.

  • Charts that use function-call or edge-triggered events wake up.

  • Charts unrelated to the event wake up.

  • Infinite recursive cycles can occur because the chart that broadcasts the event wakes up.

For code generation, machine-parented events prevent code reuse for the entire model.

R2008b

New Features, Bug Fixes, Compatibility Considerations

Support for Embedding Simulink Function-Call Subsystems in a Stateflow Chart

You can use a Simulink function to embed a function-call subsystem in a Stateflow chart. You fill this function with Simulink blocks and call it in state actions and on transitions. Like graphical functions, truth table functions, and Embedded MATLAB functions, you can use multiple return values with Simulink functions.

Support for Using Enumerated Data Types in a Stateflow Chart

You can use data of an enumerated type in a Stateflow chart.

New Alignment, Distribution, and Resizing Commands for Stateflow Charts

You can use alignment, distribution, and resizing commands on graphical chart objects, such as states, functions, and boxes.

For more information, see Formatting Chart Objects in the Stateflow User's Guide.

Unified Simulation and Embeddable Code Generation Options for Stateflow Charts and Truth Table Blocks

You can use a single dialog box to specify simulation and embeddable code generation options that apply to Stateflow charts and Truth Table blocks. These changes apply:

Type of ModelSimulation OptionsEmbeddable Code Generation Options
Nonlibrary

Migrated from the Simulation Target dialog box to the Configuration Parameters dialog box

See GUI Changes in Simulation Options for Nonlibrary Models

Enhanced with new options in the Real-Time Workshop pane of the Configuration Parameters dialog box

See GUI Enhancements in Real-Time Workshop Code Generation Options for Nonlibrary Models

Library

Migrated from the Simulation Target dialog box to the Configuration Parameters dialog box

See GUI Changes in Simulation Options for Library Models

Migrated from the RTW Target dialog box to the Configuration Parameters dialog box

See GUI Changes in Real-Time Workshop Code Generation Options for Library Models

For compatibility information, see ???.

GUI Changes in Simulation Options for Nonlibrary Models

The following sections describe changes in the panes of the Simulation Target dialog box for nonlibrary models.

Changes for the General Pane of the Simulation Target Dialog Box

ReleaseAppearance
Previous

General pane of the Simulation Target dialog box

New

Simulation Target pane of the Configuration Parameters dialog box

For details, see Nonlibrary Models: Mapping of GUI Options from the Simulation Target Dialog Box to the Configuration Parameters Dialog Box.

Changes for the Custom Code Pane of the Simulation Target Dialog Box

ReleaseAppearance
Previous

Custom Code pane of the Simulation Target dialog box

New

Simulation Target > Symbols pane of the Configuration Parameters dialog box

New

Simulation Target > Custom Code pane of the Configuration Parameters dialog box

For details, see Nonlibrary Models: Mapping of GUI Options from the Simulation Target Dialog Box to the Configuration Parameters Dialog Box.

Changes for the Description Pane of the Simulation Target Dialog Box

In previous releases, the Description pane of the Simulation Target dialog box appeared as follows.

In R2008b, these options are no longer available. For older models where the Description pane contained information, the text is now accessible only in the Model Explorer. When you select Simulink Root > Configuration Preferences in the Model Hierarchy pane, the text appears in the Description field for that model.

Nonlibrary Models: Mapping of GUI Options from the Simulation Target Dialog Box to the Configuration Parameters Dialog Box

For nonlibrary models, the following table maps each GUI option in the Simulation Target dialog box to the equivalent in the Configuration Parameters dialog box. The options are listed in order of appearance in the Simulation Target dialog box.

Old Option in the Simulation Target Dialog BoxNew Option in the Configuration Parameters Dialog BoxDefault Value of New Option
General > Enable debugging / animationSimulation Target > Enable debugging / animationon
General > Enable overflow detection (with debugging)Simulation Target > Enable overflow detection (with debugging)on
General > Echo expressions without semicolonsSimulation Target > Echo expressions without semicolonson
General > Build ActionsSimulation Target > Simulation target build modeIncremental build
NoneSimulation Target > Custom Code > Source file''
Custom Code > Include CodeSimulation Target > Custom Code > Header file''
Custom Code > Include PathsSimulation Target > Custom Code > Include directories''
Custom Code > Source FilesSimulation Target > Custom Code > Source files''
Custom Code > LibrariesSimulation Target > Custom Code > Libraries''
Custom Code > Initialization CodeSimulation Target > Custom Code > Initialize function''
Custom Code > Termination CodeSimulation Target > Custom Code > Terminate function''
Custom Code > Reserved NamesSimulation Target > Symbols > Reserved names{}
Custom Code > Use these custom code settings for all librariesNoneNot applicable
Description > Description

None

    Note:   If you load an older model that contained user-specified text in the Description field, that text now appears in the Model Explorer. When you select Simulink Root > Configuration Preferences in the Model Hierarchy pane, the text appears in the Description field for that model.

Not applicable
Description > Document LinkNoneNot applicable

    Note:   For nonlibrary models, Simulation Target options in the Configuration Parameters dialog box are also available in the Model Explorer. When you select Simulink Root > Configuration Preferences in the Model Hierarchy pane, you can select Simulation Target in the Contents pane to access the options.

GUI Changes in Simulation Options for Library Models

The following sections describe changes in the panes of the Simulation Target dialog box for library models.

Changes for the General Pane of the Simulation Target Dialog Box

In previous releases, the General pane of the Simulation Target dialog box for library models appeared as follows.

In R2008b, these options are no longer available. All library models inherit these option settings from the main model to which the libraries are linked.

Changes for the Custom Code Pane of the Simulation Target Dialog Box

ReleaseAppearance
Previous

Custom Code pane of the Simulation Target dialog box

New

Simulation Target pane of the Configuration Parameters dialog box

For details, see Library Models: Mapping of GUI Options from the Simulation Target Dialog Box to the Configuration Parameters Dialog Box.

Changes for the Description Pane of the Simulation Target Dialog Box

In previous releases, the Description pane of the Simulation Target dialog box appeared as follows.

In R2008b, these options are no longer available. For older models where the Description pane contained information, the text is discarded.

Library Models: Mapping of GUI Options from the Simulation Target Dialog Box to the Configuration Parameters Dialog Box

For library models, the following table maps each GUI option in the Simulation Target dialog box to the equivalent in the Configuration Parameters dialog box. The options are listed in order of appearance in the Simulation Target dialog box.

Old Option in the Simulation Target Dialog BoxNew Option in the Configuration Parameters Dialog BoxDefault Value of New Option
General > Enable debugging / animationNoneNot applicable
General > Enable overflow detection (with debugging)NoneNot applicable
General > Echo expressions without semicolonsNoneNot applicable
General > Build ActionsNoneNot applicable
NoneSimulation Target > Source file''
Custom Code > Include CodeSimulation Target > Header file''
Custom Code > Include PathsSimulation Target > Include directories''
Custom Code > Source FilesSimulation Target > Source files''
Custom Code > LibrariesSimulation Target > Libraries''
Custom Code > Initialization CodeSimulation Target > Initialize function''
Custom Code > Termination CodeSimulation Target > Terminate function''
Custom Code > Reserved NamesNoneNot applicable
Custom Code > Use local custom code settings (do not inherit from main model)Simulation Target > Use local custom code settings (do not inherit from main model)off
Description > DescriptionNoneNot applicable
Description > Document LinkNoneNot applicable

    Note:   For library models, Simulation Target options in the Configuration Parameters dialog box are not available in the Model Explorer.

GUI Enhancements in Real-Time Workshop Code Generation Options for Nonlibrary Models

The following sections describe enhancements to the Real-Time Workshop pane of the Configuration Parameters dialog box for nonlibrary models.

Enhancement for the Real-Time Workshop: Symbols Pane of the Configuration Parameters Dialog Box

In previous releases, the Real-Time Workshop > Symbols pane of the Configuration Parameters dialog box appeared as follows.

In R2008b, a new option is available in this pane: Reserved names. You can use this option to specify a set of keywords that the Real-Time Workshop build process should not use. This action prevents naming conflicts between functions and variables from external environments and identifiers in the generated code.

You can also choose to use the reserved names specified in the Simulation Target > Symbols pane to avoid entering the same information twice for the nonlibrary model. Select the Use the same reserved names as Simulation Target check box.

Enhancement for the Real-Time Workshop: Custom Code Pane of the Configuration Parameters Dialog Box

In previous releases, the Real-Time Workshop > Custom Code pane of the Configuration Parameters dialog box appeared as follows.

In R2008b, a new option is available in this pane: Use the same custom code settings as Simulation Target. You can use this option to copy the custom code settings from the Simulation Target > Custom Code pane to avoid entering the same information twice for the nonlibrary model.

GUI Changes in Real-Time Workshop Code Generation Options for Library Models

The following sections describe changes in the panes of the RTW Target dialog box for library models.

Changes for the General Pane of the RTW Target Dialog Box

In previous releases, the General pane of the RTW Target dialog box for library models appeared as follows.

In R2008b, these options are no longer available. During Real-Time Workshop code generation, options specified for the main model are used.

Changes for the Custom Code Pane of the RTW Target Dialog Box

ReleaseAppearance
Previous

Custom Code pane of the RTW Target dialog box

New

Real-Time Workshop pane of the Configuration Parameters dialog box

For details, see Library Models: Mapping of GUI Options from the RTW Target Dialog Box to the Configuration Parameters Dialog Box.

Changes for the Description Pane of the RTW Target Dialog Box

In previous releases, the Description pane of the RTW Target dialog box appeared as follows.

In R2008b, these options are no longer available. For older models where the Description pane contained information, the text is discarded.

Library Models: Mapping of GUI Options from the RTW Target Dialog Box to the Configuration Parameters Dialog Box

For library models, the following table maps each GUI option in the RTW Target dialog box to the equivalent in the Configuration Parameters dialog box. The options are listed in order of appearance in the RTW Target dialog box.

Old Option in the RTW Target Dialog BoxNew Option in the Configuration Parameters Dialog BoxDefault Value of New Option
General > Comments in generated codeNoneNot applicable
General > Use bitsets for storing state configurationNoneNot applicable
General > Use bitsets for storing boolean dataNoneNot applicable
General > Compact nested if-else using logical AND/OR operatorsNoneNot applicable
General > Recognize if-elseif-else in nested if-else statementsNoneNot applicable
General > Replace constant expressions by a single constantNoneNot applicable
General > Minimize array reads using temporary variablesNoneNot applicable
General > Preserve symbol namesNoneNot applicable
General > Append symbol names with parent namesNoneNot applicable
General > Use chart names with no manglingNoneNot applicable
General > Build ActionsNoneNot applicable
NoneReal-Time Workshop > Source file''
Custom Code > Include CodeReal-Time Workshop > Header file''
Custom Code > Include PathsReal-Time Workshop > Include directories''
Custom Code > Source FilesReal-Time Workshop > Source files''
Custom Code > LibrariesReal-Time Workshop > Libraries''
Custom Code > Initialization CodeReal-Time Workshop > Initialize function''
Custom Code > Termination CodeReal-Time Workshop > Terminate function''
Custom Code > Reserved NamesNoneNot applicable
Custom Code > Use local custom code settings (do not inherit from main model)Real-Time Workshop > Use local custom code settings (do not inherit from main model)off
NoneReal-Time Workshop > Use the same custom code settings as Simulation Targetoff
Description > DescriptionNoneNot applicable
Description > Document LinkNoneNot applicable

    Note:   For library models, Real-Time Workshop options in the Configuration Parameters dialog box are not available in the Model Explorer.

Mapping of Target Object Properties to Parameters in the Configuration Parameters Dialog Box

Previously, you could programmatically set options for simulation and embeddable code generation by accessing the API properties of Target objects sfun and rtw, respectively. In R2008b, the API properties of Target objects sfun and rtw are replaced by parameters that you configure using the commands get_param and set_param.

Mapping of Object Properties to Simulation Parameters for Nonlibrary Models

The following table maps API properties of the Target object sfun for nonlibrary models to the equivalent parameters in R2008b. Object properties are listed in alphabetical order; those not listed in the table do not have equivalent parameters in R2008b.

Old sfun Object PropertyOld Option in the Simulation Target Dialog BoxNew Configuration ParameterNew Option in the Configuration Parameters Dialog Box

CodeFlagsInfo
('debug')

General > Enable debugging / animation

SFSimEnableDebug

string - off, on

Simulation Target > Enable debugging / animation

CodeFlagsInfo
('overflow')

General > Enable overflow detection (with debugging)

SFSimOverflowDetection

string - off, on

Simulation Target > Enable overflow detection (with debugging)

CodeFlagsInfo
('echo')

General > Echo expressions without semicolons

SFSimEcho

string - off, on

Simulation Target > Echo expressions without semicolons
CustomCodeCustom Code > Include Code

SimCustomHeaderCode

string - ''

Simulation Target > Custom Code > Header file
CustomInitializerCustom Code > Initialization Code

SimCustomInitializer

string - ''

Simulation Target > Custom Code > Initialize function
CustomTerminatorCustom Code > Termination Code

SimCustomTerminator

string - ''

Simulation Target > Custom Code > Terminate function

ReservedNames

Custom Code > Reserved Names

SimReservedNameArray

string array - {}

Simulation Target > Symbols > Reserved names
UserIncludeDirsCustom Code > Include Paths

SimUserIncludeDirs

string - ''

Simulation Target > Custom Code > Include directories
UserLibrariesCustom Code > Libraries

SimUserLibraries

string - ''

Simulation Target > Custom Code > Libraries
UserSourcesCustom Code > Source Files

SimUserSources

string - ''

Simulation Target > Custom Code > Source files

Mapping of Object Properties to Simulation Parameters for Library Models

The following table maps API properties of the Target object sfun for library models to the equivalent parameters in R2008b. Object properties are listed in alphabetical order; those not listed in the table do not have equivalent parameters in R2008b.

Old sfun Object PropertyOld Option in the Simulation Target Dialog BoxNew Configuration ParameterNew Option in the Configuration Parameters Dialog Box
CustomCodeCustom Code > Include Code

SimCustomHeaderCode

string - ''

Simulation Target > Header file
CustomInitializerCustom Code > Initialization Code

SimCustomInitializer

string - ''

Simulation Target > Initialize function
CustomTerminatorCustom Code > Termination Code

SimCustomTerminator

string - ''

Simulation Target > Terminate function

UseLocalCustomCodeSettings

Custom Code > Use local custom code settings (do not inherit from main model)

SimUseLocalCustomCode

string - off, on

Simulation Target > Use local custom code settings (do not inherit from main model)
UserIncludeDirsCustom Code > Include Paths

SimUserIncludeDirs

string - ''

Simulation Target > Include directories
UserLibrariesCustom Code > Libraries

SimUserLibraries

string - ''

Simulation Target > Libraries
UserSourcesCustom Code > Source Files

SimUserSources

string - ''

Simulation Target > Source files

Mapping of Object Properties to Code Generation Parameters for Library Models

The following table maps API properties of the Target object rtw for library models to the equivalent parameters in R2008b. Object properties are listed in alphabetical order; those not listed in the table do not have equivalent parameters in R2008b.

Old rtw Object PropertyOld Option in the RTW Target Dialog BoxNew Configuration ParameterNew Option in the Configuration Parameters Dialog Box
CustomCodeCustom Code > Include Code

CustomHeaderCode

string - ''

Real-Time Workshop > Header file
CustomInitializerCustom Code > Initialization Code

CustomInitializer

string - ''

Real-Time Workshop > Initialize function
CustomTerminatorCustom Code > Termination Code

CustomTerminator

string - ''

Real-Time Workshop > Terminate function
UseLocalCustomCodeSettingsCustom Code > Use local custom code settings (do not inherit from main model)

RTWUseLocalCustomCode

string - off, on

Real-Time Workshop > Use local custom code settings (do not inherit from main model)
UserIncludeDirsCustom Code > Include Paths

CustomInclude

string - ''

Real-Time Workshop > Include directories
UserLibrariesCustom Code > Libraries

CustomLibrary

string - ''

Real-Time Workshop > Libraries
UserSourcesCustom Code > Source Files

CustomSource

string - ''

Real-Time Workshop > Source files

New Parameters in the Configuration Parameters Dialog Box for Simulation and Embeddable Code Generation

In R2008b, new parameters are added to the Configuration Parameters dialog box for simulation and embeddable code generation.

New Simulation Parameters for Nonlibrary Models

The following table lists the new simulation parameters that apply to nonlibrary models.

New Configuration ParameterNew Option in the Configuration Parameters Dialog BoxDescription

SimBuildMode

string – sf_incremental_build, sf_nonincremental_build, sf_make, sf_make_clean, sf_make_clean_objects

Simulation Target > Simulation target build modeSpecifies how you build the simulation target for a model.

SimCustomSourceCode

string - ''

Simulation Target > Custom Code > Source fileEnter code lines to appear near the top of a generated source code file.

New Simulation Parameter for Library Models

The following table lists the new simulation parameter that applies to library models.

New Configuration ParameterNew Option in the Configuration Parameters Dialog BoxDescription

SimCustomSourceCode

string - ''

Simulation Target > Source fileEnter code lines to appear near the top of a generated source code file.

New Code Generation Parameters for Nonlibrary Models

The following table lists the new code generation parameters that apply to nonlibrary models.

New Configuration ParameterNew Option in the Configuration Parameters Dialog BoxDescription

ReservedNameArray

string array - {}

Real-Time Workshop > Symbols > Reserved namesEnter the names of variables or functions in the generated code that match the names of variables or functions specified in custom code.

RTWUseSimCustomCode

string – off, on

Real-Time Workshop > Custom Code > Use the same custom code settings as Simulation TargetSpecify whether to use the same custom code settings as those specified for simulation.

UseSimReservedNames

string – off, on

Real-Time Workshop > Symbols > Use the same reserved names as Simulation TargetSpecify whether to use the same reserved names as those specified for simulation.

New Code Generation Parameters for Library Models

The following table lists the new code generation parameters that apply to library models.

New Configuration ParameterNew Option in the Configuration Parameters Dialog BoxDescription

CustomSourceCode

string''

Real-Time Workshop > Source fileEnter code lines to appear near the top of a generated source code file.

RTWUseSimCustomCode

string – off, on

Real-Time Workshop > Use the same custom code settings as Simulation TargetSpecify whether to use the same custom code settings as those specified for simulation.

Compatibility Considerations

Updating Scripts That Set Options Programmatically for Simulation and Embeddable Code Generation

In previous releases, you could use the Stateflow API to set options for simulation and embeddable code generation by accessing the Target object (sfun or rtw) in a Stateflow machine. For example, you could set simulation options programmatically by running these commands in a MATLAB script:

r = slroot;
machine = r.find('-isa','Stateflow.Machine','Name','main_mdl');
t_sim = machine.find('-isa','Stateflow.Target','Name','sfun');
t_sim.setCodeFlag('debug',1);
t_sim.setCodeFlag('overflow',1);
t_sim.setCodeFlag('echo',1);
t_sim.getCodeFlag('debug');
t_sim.getCodeFlag('overflow');
t_sim.getCodeFlag('echo');

In R2008b, you must update your scripts to use the set_param and get_param commands to configure simulation and embeddable code generation. For example, you can update the previous script as follows:

cs = getActiveConfigSet(gcs);
set_param(cs,'SFSimEnableDebug','on');
set_param(cs,'SFSimOverflowDetection','on');
set_param(cs,'SFSimEcho','on');
get_param(cs,'SFSimEnableDebug');
get_param(cs,'SFSimOverflowDetection');
get_param(cs,'SFSimEcho');
For information about...See...

Object properties and their equivalent parameters in R2008b

Mapping of Target Object Properties to Parameters in the Configuration Parameters Dialog Box

    Note:   Properties of Target objects sfun and rtw that are no longer supported in R2008b cannot be updated using the command-line API.

Using the set_param and get_param commands

Using Command-Line API to Set Simulation and Code Generation Parameters.

Accessing Target Options for Library Models

In previous releases, you could access target options for library models via the Tools menu in the Stateflow Editor or the Contents pane of the Model Explorer. In R2008b, you must use the Tools menu to access target options for library models. For example, to specify parameters for the simulation target, select Tools > Open Simulation Target in the Stateflow Editor.

What Happens When You Load an Older Model in R2008b

When you use R2008b to load a model created in an earlier version, dialog box options and the equivalent object properties for simulation and embeddable code generation targets migrate automatically to the Configuration Parameters dialog box, except in the cases that follow.

For the simulation target of a nonlibrary model, these options and properties do not migrate to the Configuration Parameters dialog box. The information is discarded when you load the model, unless otherwise noted.

Option in the Simulation Target Dialog Box of a Nonlibrary ModelEquivalent Object Property
Custom Code > Use these custom code settings for all librariesApplyToAllLibs
Description > DescriptionDescription

    Note:   If you load an older model that contains user-specified text in the Description field, that text now appears in the Model Explorer. When you select Simulink Root > Configuration Preferences in the Model Hierarchy pane, the text appears in the Description field for that model.

Description > Document LinkDocument

For the simulation target of a library model, these options and properties do not migrate to the Configuration Parameters dialog box. The information is discarded when you load the model.

Option in the Simulation Target Dialog Box of a Library ModelEquivalent Object Property
General > Enable debugging / animationCodeFlagsInfo('debug')
General > Enable overflow detection (with debugging)CodeFlagsInfo('overflow')
General > Echo expressions without semicolonsCodeFlagsInfo('echo')
General > Build ActionsNone
Custom Code > Reserved NamesReservedNames
Description > DescriptionDescription
Description > Document LinkDocument

For the embeddable code generation target of a library model, these options and properties do not migrate to the Configuration Parameters dialog box. The information is discarded when you load the model.

Option in the RTW Target Dialog Box of a Library ModelEquivalent Object Property
General > Comments in generated codeCodeFlagsInfo('comments')
General > Use bitsets for storing state configurationCodeFlagsInfo('statebitsets')
General > Use bitsets for storing boolean dataCodeFlagsInfo('databitsets')
General > Compact nested if-else using logical AND/OR operatorsCodeFlagsInfo('emitlogicalops')
General > Recognize if-elseif-else in nested if-else statementsCodeFlagsInfo('elseifdetection')
General > Replace constant expressions by a single constantCodeFlagsInfo('constantfolding')
General > Minimize array reads using temporary variablesCodeFlagsInfo('redundantloadelimination')
General > Preserve symbol namesCodeFlagsInfo('preservenames')
General > Append symbol names with parent namesCodeFlagsInfo('preservenameswithparent')
General > Use chart names with no manglingCodeFlagsInfo('exportcharts')
General > Build ActionsNone
Custom Code > Reserved NamesReservedNames
Description > DescriptionDescription
Description > Document LinkDocument

What Happens When You Save an Older Model in R2008b

When you use R2008b to save a model created in an earlier version, parameters for simulation and embeddable code generation from the Configuration Parameters dialog box are saved. However, properties of API Target objects sfun and rtw are not saved if those properties do not have an equivalent parameter in the Configuration Parameters dialog box. Properties that do not migrate to the Configuration Parameters dialog box are discarded when you load the model. Therefore, old Target object properties are not saved even if you choose to save the model as an older version (for example, R2007a).

Workaround for Library Models If They No Longer Use Local Custom Code Settings

Behavior in R2008a and Earlier Releases

In R2008a and earlier releases, the main model simulation target had a custom code option Use these custom code settings for all libraries, or the target property ApplyToAllLibs. The library model simulation target had a similar custom code option Use local custom code settings (do not inherit from main model), or the target property UseLocalCustomCodeSettings.

The following criteria determined which custom code settings would apply to the library model:

If ApplyToAllLibs for the main model is...And UseLocalCustomCodeSettings for the library model is...Then the library model uses...
TrueFalseMain model custom code
TrueTrueLocal custom code
False TrueLocal custom code
False False Local custom code (by default, but ambiguous)

The last case was ambiguous, because the main model did not propagate custom code settings and the library model did not specify use of local custom code settings either. In this case, the default behavior was to use local custom code settings for the library model.

Behavior in R2008b

In R2008b, the Use these custom code settings for all libraries option for the main model is removed. The library model either picks up its local custom code settings if specified to do so, or uses the main model custom code settings when the Use local custom code settings option is not selected. This change introduces backward incompatibility for older models that use the "False (main model), False (library model)" setup for specifying custom code settings.

Workaround to Prevent Backward Incompatibility

To resolve the ambiguity in older models, you must explicitly select Use local custom code settings for the library model when you want the local custom code settings to apply:

  1. Open the Stateflow simulation target for the library model.

    1. Load the library model and unlock it.

    2. Open one of the library charts in the Stateflow Editor.

    3. Select Tools > Open Simulation Target.

  2. In the dialog box that appears, select Use local custom code settings (do not inherit from main model).

New Pattern Wizard for Consistent Creation of Logic Patterns and Iterative Loops

You can use the Stateflow Pattern Wizard to create commonly used flow graphs such as for-loops in a quick and consistent manner.

Support for Initializing Vectors and Matrices in the Data Properties Dialog Box

In the Data properties dialog box, you can initialize vectors and matrices in the Initial value field of the Value Attributes pane.

For more information, see How to Define Vectors and Matrices.

Change in Default Mode for Ordering Parallel States and Outgoing Transitions

The default mode for ordering parallel states and outgoing transitions is now explicit. When you create a new chart, you define ordering explicitly in the Stateflow Editor. However, if you load a chart that uses implicit ordering, that mode is retained until you switch to explicit ordering.

Optimized Inlining of Code Generated for Stateflow Charts

In R2008b, Real-Time Workshop code generation is enhanced to enable optimized inlining of code generated for Stateflow charts.

More Efficient Parsing for Nonlibrary Models

When you parse a nonlibrary model, library charts that are not linked to this model are ignored. This enhancement enables more efficient parsing for nonlibrary models.

Change in Casting Behavior When Calling MATLAB Functions in a Chart

When you call MATLAB functions in a Stateflow chart, scalar inputs are no longer cast automatically to data of type double. This behavior applies when you use the ml operator to call a built-in or custom MATLAB function. (For details, see ml Namespace Operator.)

Compatibility Considerations

Previously, Stateflow generated code for simulation would automatically cast scalar inputs to data of type double when calling MATLAB functions in a chart. This behavior has changed. Stateflow charts created in earlier versions now generate errors during simulation if they contain calls to external MATLAB functions that expect scalar inputs of type double, but the inputs are of a different data type.

To prevent these errors, you can change the data type of a scalar input to double or add an explicit cast to type double in the function call. For example, you can change a function call from ml.function_name(i) to ml.function_name(double(i)).

Ability to Specify Continuous Update Method for Output Data

In R2008b, you can set the Update Method of output data in continuous-time charts to Continuous. In previous releases, only local data could use a continuous update method.

Use of Output Data with Change Detection Operators Disallowed for Initialize-Outputs-at-Wakeup Mode

If you enable the option Initialize Outputs Every Time Chart Wakes Up in the Chart properties dialog box, do not use output data as the first argument of a change detection operator. When this option is enabled, the change detection operator returns false if the first argument is an output data. In this case, there is no reason to perform change detection. (For details, see Detecting Changes in Data Values.)

Compatibility Considerations

Previously, Stateflow software would allow the use of output data with change detection operators when you enable the option Initialize Outputs Every Time Chart Wakes Up. This behavior has changed. Stateflow charts created in earlier versions now generate errors during parsing to prevent such behavior.

Parsing a Stateflow Chart Without Simulation No Longer Detects Unresolved Symbol Errors

To detect unresolved symbol errors in a chart, you must start simulation or update the model diagram. When you parse a chart without simulation or diagram updates, the Stateflow parser does not have access to all the information needed to check for unresolved symbols, such as exported graphical functions from other charts and enumerated data types. Therefore, the parser now skips unresolved symbol detection to avoid generating false error messages. However, if you start simulation or update the model diagram, you invoke the model compilation process, which has full access to the information needed, and unresolved symbols are flagged.

Generation of a Unique Name for a Copied State Limited to States Without Default Labels

If you copy and paste a state in the Stateflow Editor, a unique name is generated for the new state only if the original state does not use the default ? label. For more information, see Copying Graphical Objects.

New Configuration Set Created When Loading Nonlibrary Models with an Active Configuration Reference

When you load a nonlibrary model with an active configuration reference for Stateflow charts or Truth Table blocks, a copy of the referenced configuration set is created and attached to your model. The new configuration set is marked active, and the configuration reference is marked inactive. This behavior does not apply to library models.

For information about using configuration references, see Manage a Configuration Reference.

Compatibility Considerations

In previous releases, you could load a nonlibrary model with an active configuration reference for Stateflow charts or Truth Table blocks. In R2008b, the configuration reference becomes inactive after you load the model, and a warning message appears to explain this change in behavior. To restore the configuration reference to its original active state, follow the instructions in the warning message.

For more information, see Configuration References for Models with Older Simulation Target Settings.

R2008a+

Bug Fixes

R2008a

New Features, Bug Fixes, Compatibility Considerations

Support for Data with Complex Types

Stateflow charts support data with complex data types. You can perform basic arithmetic (addition, subtraction, and multiplication) and relational operations (equal and not equal) on complex data in Stateflow action language. You can also use complex input and output arguments for Embedded MATLAB functions in your chart.

For more information, see Using Complex Data in Stateflow Charts.

Support for Functions with Multiple Outputs

You can specify more than one output argument in graphical functions, truth table functions, and Embedded MATLAB functions. Previously, you could specify only one output for these types of functions.

Bidirectional Traceability for Navigating Between Generated Code and Stateflow Objects

In previous releases, Real-Time Workshop Embedded Coder software provided bidirectional traceability only for Simulink blocks. In R2008a, bidirectional traceability works between generated code and Stateflow objects.

For embedded real-time (ERT) based targets, you can choose to include traceability comments in the generated code. Using the enhanced traceability report, you can click hyperlinks to go from a line of code to its corresponding object in the model. You can also right-click an object in your model to find its corresponding line of code.

For more information, see Traceability of Stateflow Objects in Generated Code in the Stateflow documentation.

New Temporal Logic Notation for Defining Absolute Time Periods

You can use a keyword named sec to define absolute time periods based on simulation time of your chart. Use this keyword as an input argument for temporal logic operators, such as after.

For more information, see Using Temporal Logic in State Actions and Transitions in the Stateflow documentation.

New temporalCount Operator for Counting Occurrences of Events

You can use the temporalCount operator to count occurrences of explicit or implicit events. This operator can also count the seconds of simulation time that elapse during chart execution.

For more information, see Using Temporal Logic in State Actions and Transitions and Counting Events in the Stateflow documentation.

Using a Specific Path to a State for the in Operator

When you use the in operator to check state activity, you must use a specific path to a state. The operator performs a localized search for states that match the given path by looking in each level of the Stateflow hierarchy between its parent and the chart level. The operator does not do an exhaustive search of all states in the entire chart. If there are no matches or multiple matches, a warning message appears and chart execution stops. The search algorithm must find a unique match to check for state activity.

For more information, see Checking State Activity in the Stateflow documentation.

Compatibility Considerations

Previously, you could use a non-specific path to a state as the argument of the in operator, because the operator performed an exhaustive search for all states in the chart that match the given path. In the case of multiple matches, a filtering algorithm broke the tie to produce a unique state for checking activity. This behavior has changed. Stateflow charts created in earlier versions may now generate errors if they contain an in operator with a non-specific path to a state.

Enhanced MISRA C Code Generation Support

Stateflow Coder software detects missing else statements in if-else structures for generated code. This enhancement supports MISRA C rule 14.10.

Enhanced Folder Structure for Generated Code

Code files for simulation and code generation targets now reside in the slprj folder. Previously, generated code files resided in the sfprj folder.

For more information, see Generated Code Files for Targets You Build in the Stateflow documentation.

Code Optimization for Simulink Blocks and Stateflow Charts

In R2008a, Real-Time Workshop code generation is enhanced to enable cross-product optimizations between Simulink blocks and Stateflow charts.

New fitToView Method for Zooming Objects in the Stateflow Editor

You can use the API method fitToView to zoom in on graphical objects in the Stateflow Editor.

For more information, see Zooming a Chart Object with the API in the Stateflow documentation.

Generation of a Unique Name for a Copied State

If you copy and paste a state in the Stateflow Editor, a unique name automatically appears for the new state.

For more information, see Copying Graphical Objects in the Stateflow documentation.

New Font Size Options in the Stateflow Editor

In the Stateflow Editor, the font sizes in the Edit > Set Font Size menu now include 2-point, 4-point, and 50-point. These font options are also available by right-clicking a text item and choosing Font Size from the context menu.

For more information, see Specifying Colors and Fonts in a Chart in the Stateflow documentation.

New Fixed-Point Details Display in the Data Properties Dialog Box

The Data Type Assistant in the Data properties dialog box now displays status and details of fixed-point data types.

For more information, see Showing Fixed-Point Details in the Stateflow documentation.

"What's This?" Context-Sensitive Help Available for Simulink Configuration Parameters Dialog

R2008a introduces "What's This?" context-sensitive help for parameters that appear in the Simulink Configuration Parameters dialog. This feature provides quick access to a detailed description of the parameters, saving you the time it would take to find the information in the Help browser.

To use the "What's This?" help, do the following:

  1. Place your cursor over the label of a parameter.

  2. Right-click. A What's This? context menu appears.

    For example, the following figure shows the What's This? context menu appearing after a right-click on the Start time parameter in the Solver pane.

  3. Click What's This? A context-sensitive help window appears showing a description of the parameter.

Specifying Scaling Explicitly for Fixed-Point Data

When you define a fixed-point data type in a Stateflow chart, you must specify scaling explicitly in the General pane of the Data properties dialog box. For example, you cannot enter an incomplete specification such as fixdt(1,16) in the Type field. If you do not specify scaling explicitly, you will see an error message when you try to simulate your model.

To ensure that the data type definition is valid for fixed-point data, perform one of these steps in the General pane of the Data properties dialog box:

  • Use a predefined option in the Type drop-down menu.

  • Use the Data Type Assistant to specify the Mode as fixed-point.

For more information, see Defining Data in the Stateflow documentation.

Compatibility Considerations

Previously, you could omit scaling in data type definitions for fixed-point data. Such data types were treated as integers with the specified sign and word length. This behavior has changed. Stateflow charts created in earlier versions may now generate errors if they contain fixed-point data with no scaling specified.

Use of Data Store Memory Data in Entry Actions and Default Transitions Disallowed for Execute-at-Initialization Mode

If you enable the option Execute (enter) Chart At Initialization in the Chart properties dialog box, you cannot assign data store memory data in state entry actions and default transitions that execute the first time that the chart awakens. You can use data store memory data in state during actions, inner transitions, and outer transitions without any limitations.

Previously, assigning data store memory in state entry actions and default transitions with this option enabled would cause a segmentation violation.

Enhanced Warning Message for Target Hardware That Does Not Support the Data Type in a Chart

If your target hardware does not support the data type you use in a Stateflow chart, a warning message appears when you generate code for that chart. This message appears only if the unsupported data type is present in the chart.

Previously, a warning message appeared if the target hardware did not support a given data type, even when the unsupported data type was not actually used in the chart.

Detection of Division-By-Zero Violations When Debugger Is Off

Stateflow simulation now detects division-by-zero violations in a chart, whether or not you enable the debugger.

Previously, disabling the debugger would prevent detection of division-by-zero violations, which caused MATLAB sessions to crash.

R2007b+

Bug Fixes

R2007b

New Features, Bug Fixes, Compatibility Considerations

Enhanced Continuous-Time Support with Zero-Crossing Detection

Using enhanced support for modeling continuous-time systems, you can:

  • Detect zero crossings on state transitions, enabling accurate simulation of dynamic systems with modal behavior.

  • Support the definition of continuous state variables and their derivatives for modeling hybrid systems as state charts with embedded dynamic equations

Compatibility Considerations

Previously, Stateflow charts implemented continuous time simulation without maintaining mode in minor time steps or detecting zero crossings. Accurate continuous-time simulation requires several constraints on the allowable constructs in Stateflow charts. Charts created in earlier versions may generate errors if they violate these constraints.

New Super Step Feature for Modeling Asynchronous Semantics

Using a new super step property, you can enable Stateflow charts to take multiple transitions in each simulation time step. For more information, see Execution of a Chart with Super Step Semantics in the Stateflow documentation.

Support for Inheriting Data Properties from Simulink Signal Objects Via Explicit Resolution

You can use a new data property, Data Must Resolve to Simulink signal object, to allow local and output data to explicitly inherit the following properties from Simulink.Signal objects of the same name that you define in the base workspace or model workspace:

  • Size

  • Type

  • Complexity

  • Minimum value

  • Maximum value

  • Initial value

  • Storage class (in Real-Time Workshop generated code)

For more information, see Resolving Data Properties from Simulink Signal Objects in the Stateflow documentation.

Compatibility Considerations

Stateflow software no longer performs implicit signal resolution, a feature supported for output data only. In prior releases, Stateflow software attempted to resolve outputs implicitly to inherit the size, type, complexity, and storage class of Simulink.Signal objects of the same name that existed in the base or model workspace. No other properties could be inherited from Simulink signals.

Now, local as well as output data can inherit additional properties from Simulink.Signal objects, but you must enable signal resolution explicitly. In models developed before Version 7.0 (R2007b) that rely on implicit signal resolution, Stateflow charts may not simulate or may generate code with unexpected storage classes. In these cases, Stateflow software automatically disables implicit signal resolution for chart outputs and generates a warning at model load time about possible incompatibilities. Before loading such a model, make sure you have loaded into the base or model workspace all Simulink.Signal objects that will be used for explicit resolution. After loading, resave your model in Version 7.0 (R2007b) of Stateflow software.

Common Dialog Box Interface for Specifying Data Types in Stateflow Charts and Simulink Models

You can use the same dialog box interface for specifying data types in Stateflow charts and Simulink models. For more information, see Setting Data Properties in the Data Dialog Box in the Stateflow documentation.

Support for Animating Stateflow Charts in Simulink External Mode

When running Simulink models in external mode, you can now animate states, and view Stateflow test points in floating scopes and signal viewers. For more information, see Animating Stateflow Charts in the Stateflow documentation.

These Real-Time Workshop targets support Stateflow chart animation in external mode:

Real-Time Workshop TargetExternal Mode SupportSupport for Stateflow Chart Animation in External Mode
GRT (generic real-time)R10Yes
VxWorks® / Tornado®R10Yes
RTWin (Real-Time Windows)R11Yes
xPCR12 *No **
ERT (embedded real-time)R13Yes
RSim (rapid simulation)R13Yes
MPC5xxR2007aNo
C166®R2007aNo
TI's C6000™R2007aYes
TI's C2000™R2007bNo
Rapid AcceleratorR2007bYes
dSPACE® RTIR12.1 ***No

    Note:  

    *xPC supported parameter download only from release R12 through R14sp3. As of release R2006a, xPC supports signal upload as well.
    **xPC has documented support for xpcexplr to display the boolean value of test point Stateflow states. You can also retrieve the state value via the xPC command-line API. There is no documented support for animating a Stateflow chart that is running in Simulink external mode.
    ***dSPACE RTI supports parameter download only.

Support for Target Function Library

Stateflow Coder code generation software supports the Target Function Library published by Real-Time Workshop Embedded Coder software, allowing you to map a subset of built-in math functions and arithmetic operators to target-specific implementations. For more information, see Replacing Operators with Target-Specific Implementations and Replacement of C Math Library Functions with Target-Specific Implementations in the Stateflow documentation.

Support for Fixed-Point Parameters in Truth Table Blocks

You can now define fixed-point parameters in Truth Table blocks.

Support for Using Custom Storage Classes to Control Stateflow Data in Generated Code

You can use custom storage classes to control Stateflow local data, output data, and data store memory in Real-Time Workshop generated code.

For more information, see Custom Storage Classes in the Real-Time Workshop Embedded Coder documentation.

Loading 2007b Stateflow Charts in Earlier Versions of Simulink Software

If you save a Stateflow chart in release 2007b, you will not be able to load the corresponding model in earlier versions of Simulink software. To work around this issue, save your model in the earlier version before loading it, as follows:

  1. In the Simulink model window, select File > Save As.

  2. In the Save as type field, select the version in which you want to load the model.

    For example, if you want to load the model in the R2007a version of Simulink software, select Simulink 6.6/R2007a Models (#.mdl).

Bug Fixed for the History Junction

In previous releases, there was a bug where a default transition action occurred more than once if you used a history junction in a state containing only a single substate. The history junction did not remember the state's last active configuration unless there was more than one substate. This bug has been fixed.

R2007a+

Bug Fixes

R2007a

New Features, Bug Fixes

New Operators for Detecting Changes in Data Values

You can use three new operators for detecting changes in Stateflow data values between time steps:

  • hasChanged

  • hasChangedFrom

  • hasChangedTo

For more information, see Detecting Changes in Data Values in the Stateflow documentation.

Elimination of "goto" Statements from Generated Code

The code generation process automatically eliminates goto statements from generated code to produce structured, readable code that better supports MISRA C rules.

R2006b

New Features, Bug Fixes

Support for Mealy and Moore Charts

You can use a new chart property to constrain finite state machines to use either Mealy or Moore semantics. You can create Stateflow charts that implement pure Mealy or Moore semantics as a subset of Stateflow chart semantics. Mealy and Moore charts can be used in simulation and code generation of C and hardware description language (HDL). See Building Mealy and Moore Charts in the Stateflow documentation.

New Structure Data Type Provides Support for Buses

You can use a structure data type to interface Simulink bus signals with Stateflow charts and truth tables, and to define local and temporary structures. You specify Stateflow structure data types as Simulink.Bus objects. See Working with Structures and Bus Signals in Stateflow Charts in the Stateflow documentation.

    Note:   Signal logging is not available for Stateflow structures.

Custom Integer Sizes

Integers are no longer restricted in size to 8, 16, or 32 bits. You can now enter word lengths of any size from one to 32 bits.

R2006a+

No New Features or Changes

R2006a

New Features

Option to Initialize Outputs When Chart Wakes Up

You can use a new chart option Initialize Outputs Every Time Chart Wakes Up. Use this to initialize the value of outputs every time a chart wakes up, not only at time 0 (see Setting Properties for a Single Chart in the online documentation). When you enable this option, outputs are reset whenever the chart is triggered, whether by a function call, edge trigger, or clock tick. The option ensures that outputs are defined in every chart execution and prevents latching of outputs.

Ability to Customize the Stateflow User Interface

You can use MATLAB code to perform the following customizations of the standard Stateflow user interface:

  • Add items and submenus that execute custom commands in the Stateflow Editor

  • Disable or hide menu items in the Stateflow Editor

Using the MATLAB Workspace Browser for Debugging Stateflow Charts

The MATLAB Workspace Browser is no longer available for debugging Stateflow charts. To view Stateflow data values at breakpoints during simulation, use the MATLAB command line or the Browse Data window in the Stateflow Debugger.

Chart and Truth Table Blocks Require C Compiler for 64-Bit Windows Operating Systems

No C compiler ships with Stateflow software for 64-bit Windows operating systems. Because Stateflow software performs simulation through code generation, you must supply your own MEX-supported C compiler if you wish to use Stateflow Chart and Truth Table blocks. The C compilers available at the time of this writing for 64-bit Windows operating systems include the Microsoft Platform SDK and the Microsoft Visual Studio development system.

R14SP3

New Features

Data Handling

Sharing Global Data Between Simulink Models and Stateflow Charts

This release provides an interface that gives Stateflow charts access to global variables in Simulink models. A Simulink model implements global variables as data stores, created either as data store memory blocks or instances of Simulink.Signal objects. Now Stateflow charts can share global data with Simulink models by reading and writing data store memory symbolically using the Stateflow action language. See Sharing Global Data with Multiple Charts in the Stateflow documentation.

Enhancements to Data Properties Dialog Box

The Stateflow data properties dialog box has been enhanced to:

  • Accommodate fixed-point support

  • Support parameter expressions in data properties

Stateflow charts now accept Simulink parameters or parameters defined in the MATLAB workspace for the following properties in the data properties dialog box:

  • Initial Value

  • Minimum

  • Maximum

Entries for these parameters can be expressions that meet the following requirements:

  • Expressions must evaluate to scalar values.

  • For library charts, the expressions for these properties must evaluate to the same value for all instances of the library chart. Otherwise, a compile-time error appears.

See Defining Data in the Stateflow documentation.

Truth Table Enhancements

Using Embedded MATLAB Action Language in Truth Tables

You can now use the Embedded MATLAB action language in Stateflow truth tables. Previously, you were restricted to the Stateflow action language. The Embedded MATLAB action language offers the following advantages:

  • Supports the use of control loops and conditional constructs in truth table actions

  • Provides direct access to all MATLAB functions

See Truth Table Functions for Decision-Making Logic in the Stateflow documentation.

Embedded MATLAB Truth Table Block in Simulink Models

A truth table function block is now available as an element in the Simulink library. With this new block, you can call a truth table function directly from your Simulink model. Previously, there was a level of indirection. Your Simulink model had to include a Stateflow block that called a truth table function.

The Simulink truth table block supports the Embedded MATLAB language subset only. You must have a Stateflow software license to use the Truth Table block in Simulink models.

See Truth Table Functions for Decision-Making Logic in the Stateflow documentation.

API Enhancements

Retrieving Object Handles of Selected Stateflow Objects

A new Stateflow function sfgco retrieves the object handles of the most recently selected objects in a Stateflow chart.

Default Case Handling in Generated Code

Stateflow Coder software now implements a default case in generated switch statements to account for corrupted memory at runtime. In this situation, the default case performs a recovery operation by calling the child entry functions of the state whose variable is out of bounds. Reentering the state resets the variable to a valid value.

This recovery operation is not performed if a Stateflow chart contains any of the following elements:

  • Local events

  • Machine-parented events

  • Implicit events, such as state entry, state exit, and data change

If any of these conditions exist in a chart, state machine processing can become recursive, causing variables to temporarily assume values that are out of range. However, when processing finishes, the variables return to valid values.

Greater Usability

Specifying Execution Order of Parallel States Explicitly

You can specify the execution order of parallel states explicitly in Stateflow charts. Previously, the execution order of parallel states was governed solely by implicit rules, based on geometry. A disadvantage of implicit ordering is that it creates a dependency between design layout and execution priority. When you rearrange parallel states in your chart, you may inadvertently change order of execution and affect simulation results. Explicit ordering gives you more control over your designs. See Execution Order for Parallel States in the Stateflow documentation.

Hyperlinking Simulink Subsystems from Stateflow Events

You can now directly hyperlink the Simulink subsystem connected to a Stateflow output event by using the context menu option Explore for any state or transition broadcasting event. See Accessing Simulink Subsystems Triggered By Output Events in the Stateflow documentation.

Warnings for Transitions Looping Out of Logical Parent

A common modeling error is to create charts where a transition loops out of the logical parent of the source and destination objects. The logical parent is either a common parent of the source and destination objects, or if there is no common parent, the nearest common ancestor.

Consider the following example:

In this chart, transition 1 loops outside of logical parent A, which is the common parent of transition source B and destination C.

This type of illegal looping causes the parent to deactivate and then reactivate. In the previous example, if transition 1 is taken, the exit action of A executes and then the entry action of A executes. Executing these actions unintentionally can cause side effects.

This situation is now detected as a parser warning that indicates how to fix the model. Here is the warning associated with the earlier example:

Differentiating Syntax Elements in the Stateflow Action Language

You can now use color highlighting to differentiate syntax elements in the Stateflow action language. Syntax highlighting is enabled by default. To specify highlighting preferences, select Highlighting Preferences from the chart Edit menu, and then click the colors you want to change. See Differentiating Syntax Elements in the Stateflow Action Language in the Stateflow documentation.

Stateflow Chart Notes Click Function

This release introduces enhancements to Stateflow chart notes. The chart notes property dialog box now has a ClickFcn section, which includes the following options:

  • Use display text as click callback check box

  • ClickFcn edit field

See Annotations Properties Dialog Box in the Simulink documentation for a description of these new options.

Chart Viewing Enhancements

This release adds the following chart viewing enhancements:

View Command History

This release enhances the chart viewing commands. You can now maintain a history of the chart viewing commands, i.e., pan and zoom, that you execute for each chart window. The history allows you to quickly return to a previous view in a window, using commands for traversing the history (see New View Menu Viewing Commands).

New View Menu Viewing Commands

This release adds the following viewing commands to the chart's View menu:

  • View > Back

    Displays the previous view in the view history.

  • View > Forward

    Displays the next view in the view history.

  • View > Go To Parent

    Goes to the parent of the current subchart.

New Shortcut Menu Commands

The shortcut menu now has Forward and Go To Parent commands. The Back command has been moved to be with these new commands. These commands are the same as those described in New View Menu Viewing Commands.

View Command Shortcut Keys

This release adds the following viewing command shortcut keys for users running the UNIX operating system or the Windows operating system:

Shortcut KeyCommand
d or Ctrl+Left ArrowPan left
g or Ctrl+Right ArrowPan right
e or Ctrl+Up ArrowPan up
c or Ctrl+Down ArrowPan down
bGo back in pan/zoom history
tGo forward in pan/zoom history

    Note   These shortcut keys, together with the existing zoom shortcuts (r or + for zoom in, v or - for zoom out), allow you to pan and zoom a model with one hand (your left hand).

R14SP2

New Features, Compatibility Considerations

User-Specified Transition Execution Order

Stateflow charts now support a mode where you can explicitly specify the testing or execution order of transitions sourced by states and junctions. This mode is called the explicit mode. The implicit mode retains the old functionality, where the transition execution order is determined based on a set of rules (parent depth, triggered and conditional properties, and geometry around the source). In addition, the transition numbers, according to their execution order, now appear on the Stateflow Editor at all times, in both implicit and explicit modes.

Old models created in earlier releases load in implicit mode, which produces identical simulation results. Any new charts created use implicit mode by default. To change to explicit mode, use the Chart properties dialog box.

Enhanced Integration of Stateflow Library Charts with Simulink Models

Charts in library models do not require full specification of data type and size. During simulation, library charts can inherit data properties from the main model in which you link them.

This enhancement also affects code generation in library charts. When building simulation and code generation targets, only the library charts that you link in the main model participate in code generation.

Compatibility Considerations

In previous releases, library charts required complete specification of data properties. You had to enter these properties for both the library chart and the main model before simulation.

Stateflow Charts and Embedded MATLAB Functions Support Simulink Data Type Aliases

Data in Stateflow charts and Embedded MATLAB functions may now be explicitly typed using the same aliased types that a Simulink model uses. Also, inherited and parameterized data types in Stateflow charts and Embedded MATLAB functions support propagation of aliased types. However, code generated for Stateflow charts and Embedded MATLAB functions does not yet preserve aliased data types.

Fixed-Point Override Supported for Library Charts

You can now specify fixed-point override for Stateflow library charts.

Compatibility Summary

ReleaseFeatures or Changes with Compatibility Considerations
R2014b
R2014a
R2013bNone
R2013a
R2012b
R2012a
R2011bDetection of State Inconsistency Errors at Compile Time Instead of Run Time
R2011a
R2010bSP2None
R2010bSP1None
R2010bPassing Real Values to Function Inputs of Complex Type Disallowed
R2010a
R2009bSP1None
R2009bNew Compilation Report for Embedded MATLAB Functions in Stateflow Charts
R2009a
R2008b
R2008a+None
R2008a
R2007b+None
R2007b
R2007a+None
R2007aNone
R2006bNone
R2006a+None
R2006aNone
R14SP3None
R14SP2Enhanced Integration of Stateflow Library Charts with Simulink Models
Was this topic helpful?