MATLAB: Do I receive unexpected results and/or a segmentation violation when linearizing a model that contains Embedded MATLAB Function blocks using Simulink Control Design 1.2 (R14SP2)

analysiscontrolcrashdesignemlerrorlinearlinearizationsegvsimulinkSimulink Control Designtoolwindows

I have a Simulink model which contains an Embedded MATLAB Function block. The first inport of this block has a width greater than one (vector or matrix input).
When I linearize this model by using the Linear Analysis GUI ("Tools -> Linear Analysis"), I receive unexpected results. I receive different results if I add intermediate outports on some of the signals. I also experience frequent segmentation violations and/or crashes when linearizing the model or modifying the inports and outports used for linearization. The stack trace of the segmentation violation is as follows:
[0] m_interpreter.dll:bool __cdecl accelHotCode(struct _accelOp *,struct _accelOp * *,int *,bool *,__int64 *,bool *)(0x14cc9800, 0x00cd98cb, 0, 0x00cd987f) + 88 bytes
[1] m_interpreter.dll:int __cdecl accelExec(struct _accelBytecode *,enum inMarshalType *)(0x14ad5d48, 0x00cd9944, 1, 0) + 19097 bytes
[2] m_interpreter.dll:bool __cdecl inExecuteHotSegment(struct _inJitAccelInfo *,enum opcodes *,int *)(0x00cd99d0, 0x00cd9a74, 0x00cd9a1c "µ\r", 0x12116d20 "`£Í") + 1535 bytes
[3] m_interpreter.dll:int __cdecl inInterp(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag volatile *)(1, 3684, 257, 0) + 283 bytes
[4] m_interpreter.dll:int __cdecl inInterPcodeSJ(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag *)(1, 3684, 9, 0) + 272 bytes
[5] m_interpreter.dll:int __cdecl inExecuteMFunctionOrScript(class Mfh_mp *,bool)(0x15811200, 0, 1, 0x00cd9fd8) + 714 bytes
[6] m_interpreter.dll:_inWordsj(1, 0x00cd9f78, 1, 0x00cd9fd8) + 443 bytes
<SNIP>

Best Answer

This bug has been fixed in Release 2006a (R2006a). For previous product releases, read below for any possible workarounds:
There is a bug in Simulink Control Design 1.2 (R14SP2) in the way that unexpected results are returned and/or a segmentation violation occurs when linearizing models which contain Embedded MATLAB Function blocks whose first inport is of width greater than one.
To work around this issue, separate the inputs to the Embedded MATLAB block into multiple inports. The first input must be of width one. To easily view the widths of the input signals, select "Format -> Port/Signal Displays -> Signal Dimensions" from the Simulink and then select "Edit -> Update Diagram".