MATLAB: Do I receive a segmentation violation when I execute a Stateflow chart containing objects of size “0” in Stateflow 6.1 (R14SP1)

0chart;dataobjectscalarstateflow

I have defined the size of a few Stateflow data objects to "0". When I try to execute this Stateflow chart, I receive the following segmentation violation:
------------------------------------------------------------------------
Segmentation violation detected at Fri Jul 08 18:14:59 2005
------------------------------------------------------------------------
Configuration:
MATLAB Version: 7.0.1.24704 (R14) Service Pack 1
MATLAB License: DEMO
Operating System: Microsoft Windows XP
Window System: Version 5.1 (Build 2600: Service Pack 1)
Processor ID: x86 Family 6 Model 8 Stepping 6, GenuineIntel
Virtual Machine: Java 1.4.2_04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
(mixed mode)
Default Charset: ibm-5348_P100-1997
Register State:
EAX = 00000000 EBX = 00cc9da8
ECX = 1e73c5b8 EDX = 00000002
ESI = 00000000 EDI = 1e6fa3b0
EBP = 00cc9cdc ESP = 00cc9cdc
EIP = 7a71faa6 FLG = 00010202
Stack Trace:
[0] cg_ir.dll:_cg_node_def_enum_value(0, 0x00cc9d00, 0x7a7632a7, 0) + 6 bytes
[1] cg_ir.dll:public: static enum CG::CoreOp __cdecl CG::Core::op(struct CG_Node_struct *)(0, 0x1e6fa3b0, 0, 0x1e6fa3b0) + 12 bytes
[2] cg_ir.dll:private: bool __thiscall CG::EliminateEmptyMatrix::call_is_element_wise(struct CG_Node_struct *)(0x1e6fa3b0, 0x00cc9da8, 0x1e2e1340, 0x00cc9da8) + 23 bytes
[3] cg_ir.dll:private: struct CG_Node_struct * __thiscall CG::EliminateEmptyMatrix::fixup_expr(struct CG_Cfg_struct *,struct CG_Node_struct *,struct CG_Edge_struct *)(0x1e32c908, 0x1e6fa3b0, 0x1e6fa3f8, 0x1e530098) + 52 bytes
<snip>

Best Answer

This bug has been fixed in Release 2006a (R2006a). For previous product releases, read below for any possible workarounds:
This is a bug in Stateflow 6.1 (R14SP1) in the way it handles empty matrices.
To work around this issue, perform the following steps:
1. Open the Stateflow model.
2. Execute the following command to change all the data objects which have a "0" size to a "1" size, which denotes a scalar:
sf('set',sf('find','all','data.props.array.size','0'),'data.props.array.size','1')
3. Save the model.