embedded matlab function cause matlab stop
1 次查看(过去 30 天)
显示 更早的评论
i use matlab 2015a and it was working fine, when i used embedded matlab function in simulink it cause matlab to stop and give error " matlab has encountered internal problem and needs to close " even when i use example from help
-------------------------------------------------------------
This segmentation violation occurred while executing the
S-function 'sf_sfun' in block 'e'.
A common cause of this segmentation violation is an incorrect
input port direct feedthrough setting. Each input port of the
S-function that is read (accessed) in mdlOutputs and/or
mdlGetTimeOfNextVarHit must specify that it needs its input
signal in these routines by setting direct feedthrough for
these input ports.
Another cause can be incorrect memory accesses which occur
when your code accesses beyond the end of an array. For example
if you access input port 5 and in mdlInitializeSizes specify
that you only have 4 input ports.
To debug your C-MEX S-function, you can enable diagnostics
by compiling the S-function source with the -g flag, e.g.,
mex -g sfunction_name.c
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!