急!!!matlab调用VC产生的mex函数运行过程中经常弹出一个窗口报错然后强制你退出matlab软件。

报错弹出那窗口有3个按钮 一个是End now 一个是Attempt to continue 还有一个Details 有时候摁Attempt to continue也能把程序运行完得出数据,但是之后就必须关闭matlab软件了。
调用这个mex函数可以输出一个数值例如[a]=mexfunction[b],简单点说,例如我做个for循环,
for i=1:N
b=i*e3;
[a]=mexfunction[b];
A(i)=a;
end
循环次数越多,报错的概率越大,偶尔也正常运行。如果不用for循环,或者循环次数少,报错就少甚至就不报错。请问这是怎么回事?
details我截取了一段如下:
MATLAB crash file:C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\matlab_crash_dump.176
------------------------------------------------------------------------
Segmentation violation detected at Sat Jan 12 15:48:33 2013
------------------------------------------------------------------------

Configuration:
MATLAB Version: 7.8.0.347 (R2009a)
MATLAB License: 161051
Operating System: Microsoft Windows XP
Window System: Version 5.1 (Build 2600: Service Pack 3)
Processor ID: x86 Family 6 Model 7 Stepping 10, GenuineIntel
Virtual Machine: Java 1.6.0_04-b12 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
Default Encoding: GBK

Fault Count: 1

Register State:
EAX = 60000000 EBX = 00000000
ECX = 3ee02a88 EDX = 01170608
ESI = 0d331288 EDI = 01170000
EBP = 00c2d334 ESP = 00c2d278
EIP = 7c948c0b FLG = 00210207

Stack Trace:
[0] ntdll.dll:0x7c948c0b(0x01170000, 0, 0x0d3312a8, 0x2630bd71)
[1] MSVCR80.dll:0x78134c39(0x0d3312a8, 0x00c2d3b0 "赜�, 0x7b35cd15, 0x0d3312b0)
[2] libmwfl.dll:0x782e331b(0x0d3312b0, 0x0c900770, 0x7b35ce8e, 0x0c900770)
[3] libmx.dll:void __cdecl mxDestroyArrayContents(struct mxArray_tag *)(0x0c900770, 0x0c8f4e28, 27, 0x1d024040) + 101 bytes
省略
[60] kernel32.dll:0x7c817077(0x0040324a, 0, 0x78746341, 32)

Please follow these steps to report this problem to The MathWorks so we
have the best chance of correcting it:

The next time MATLAB is launched under typical usage, a dialog box will
open to help you send the error log to The MathWorks. Alternatively, you
can send an e-mail to [email protected] with the following file attached:
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\matlab_crash_dump.176

If the problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/ts/help_request_1.html

A technical support engineer might contact you with further information.

Thank you for your help. MATLAB may attempt to recover, but even if recovery appears successful,
we recommend that you save your workspace and restart MATLAB as soon as possible.

第1个回答  2016-06-08
这个常见,一般是函数有错,却能编译过去。比如指针操作有问题导致内存溢出。
第2个回答  2013-01-17
你检查过mexfunction函数内层语句有问题没?
还有你不能设置只有mex这三个单词的程序,会与matlab内置函数有冲突。本回答被网友采纳
相似回答