当我执行一个调用我的gensm.mexw64的m文件时,MATLAB崩溃了。但是,当我在调试模式下运行程序时,没有任何反应。
代码是
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]){
int N = 0, Ndet = 0, Nviews = 0;
double lm = 0, *s0_ptr = NULL,*d0_ptr = NULL,*views_ptr = NULL;
vector<Vec2d> s0,d0;
vector<double> views;
unsigned short dim = 2;
unsigned int sz[2];
double FOV[2];
checkInputs(nrhs, prhs);
N = static_cast<int>(*mxGetPr(prhs[0]));
sz[0] = N; sz[1] = N;
lm = *mxGetPr(prhs[1]);
FOV[0] = lm; FOV[1] = lm;
s0_ptr = mxGetPr(prhs[2]);
d0_ptr = mxGetPr(prhs[3]);
views_ptr = mxGetPr(prhs[4]);
Ndet = mxGetN(prhs[2]);
Nviews = mxGetNumberOfElements(prhs[4]);
s0.resize(Ndet); d0.resize(Ndet);
for(int i = 0; i < Ndet; i++){
s0[i](0) = s0_ptr[2 * i];
s0[i](1) = s0_ptr[2 * i + 1];
d0[i](0) = d0_ptr[2 * i];
d0[i](1) = d0_ptr[2 * i + 1];
}
views.assign(views_ptr, views_ptr + Nviews);
CTSystem cts(s0,d0,views,dim,sz,FOV);
cts.generateSystemMatrix();
Mat smt;
cts.smTuple(smt);
plhs[0] = ocvMxArrayFromImage_double(smt);
}
崩溃信息如下
MATLAB crash file:C:\Users\hyzhang\AppData\Local\Temp\matlab_crash_dump.3164-1:
Access violation detected at Sun Mar 01 21:29:28 2015
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Default Encoding : windows-1252
Graphics card 1 : Intel Corporation ( 0x8086 ) Intel(R) HD Graphics 3000 Version 9.17.10.2932
Graphics card 2 : (标准显示卡类型) ( 0x10de ) 标准 VGA 图形适配器 Version 6.1.7600.16385
MATLAB Architecture: win64
MATLAB Root : E:\Program Files\MATLAB\R2014b
MATLAB Version : 8.4.0.150421 (R2014b)
Operating System : Microsoft Windows 7 旗舰版
Processor ID : x86 Family 6 Model 42 Stepping 7, GenuineIntel
Software OpenGL : 0
Virtual Machine : Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : Version 6.1 (Build 7601: Service Pack 1)
Stack Trace (from fault):
[ 0] 0x000007fefb51289b E:\software files\engineering physics\Bachelor's Degree\Program\My Code_sparse\SystemMatrix\gensm.mexw64+00010395 mexFunction+00001275
[ 1] 0x000007fefb5148a9 E:\software files\engineering physics\Bachelor's Degree\Program\My Code_sparse\SystemMatrix\gensm.mexw64+00018601 mexFunction+00009481
[ 2] 0x000007fefb51275f E:\software files\engineering physics\Bachelor's Degree\Program\My Code_sparse\SystemMatrix\gensm.mexw64+00010079 mexFunction+00000959
[ 3] 0x00000000fc5f3701 E:\Program Files\MATLAB\R2014b\bin\win64\libmex.dll+00079617 mexRunMexFile+00000129
[ 4] 0x00000000fc5f2762 E:\Program Files\MATLAB\R2014b\bin\win64\libmex.dll+00075618 inSwapMexfileReader+00000690
[ 5] 0x00000000fc5f2248 E:\Program Files\MATLAB\R2014b\bin\win64\libmex.dll+00074312 mexUnlock+00006008
[ 6] 0x0000000004cf05e3 E:\Program Files\MATLAB\R2014b\bin\win64\m_dispatcher.dll+00067043 Mfh_file::dispatch_fh+00000659
[ 7] 0x0000000004cf0aee E:\Program Files\MATLAB\R2014b\bin\win64\m_dispatcher.dll+00068334 Mfunction_handle::dispatch+00000766
[ 8] 0x0000000004ddb606 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00112134 MathWorks::MException::IMExceptionData::IMExceptionData+00037094
[ 9] 0x0000000004ddaa20 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00109088 MathWorks::MException::IMExceptionData::IMExceptionData+00034048
[ 10] 0x0000000004dd9219 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00102937 MathWorks::MException::IMExceptionData::IMExceptionData+00027897
[ 11] 0x0000000004dd8de5 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00101861 MathWorks::MException::IMExceptionData::IMExceptionData+00026821
[ 12] 0x0000000004e2b708 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00440072 inPathNotification::function_delete_notification+00128952
[ 13] 0x0000000004e03ea5 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00278181 inGetNameInSymbolTable+00022053
[ 14] 0x0000000004e01b4f E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00269135 inGetNameInSymbolTable+00013007
[ 15] 0x0000000004e01ab1 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00268977 inGetNameInSymbolTable+00012849
[ 16] 0x0000000004e2406f E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00409711 inPathNotification::function_delete_notification+00098591
[ 17] 0x0000000004e227af E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00403375 inPathNotification::function_delete_notification+00092255
[ 18] 0x0000000004e21359 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00398169 inPathNotification::function_delete_notification+00087049
[ 19] 0x0000000004cf07a4 E:\Program Files\MATLAB\R2014b\bin\win64\m_dispatcher.dll+00067492 Mfh_file::dispatch_fh+00001108
[ 20] 0x0000000004cf0aee E:\Program Files\MATLAB\R2014b\bin\win64\m_dispatcher.dll+00068334 Mfunction_handle::dispatch+00000766
[ 21] 0x0000000004e02b2f E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00273199 inGetNameInSymbolTable+00017071
[ 22] 0x0000000004eeb6f7 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+01226487 inFullEvalFcn+00011159
[ 23] 0x0000000004e05592 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00284050 inGetNameInSymbolTable+00027922
[ 24] 0x0000000004e01b4f E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00269135 inGetNameInSymbolTable+00013007
[ 25] 0x0000000004e01ab1 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00268977 inGetNameInSymbolTable+00012849
[ 26] 0x0000000004e2406f E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00409711 inPathNotification::function_delete_notification+00098591
[ 27] 0x0000000004e227af E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00403375 inPathNotification::function_delete_notification+00092255
[ 28] 0x0000000004e21359 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00398169 inPathNotification::function_delete_notification+00087049
[ 29] 0x0000000004cf07a4 E:\Program Files\MATLAB\R2014b\bin\win64\m_dispatcher.dll+00067492 Mfh_file::dispatch_fh+00001108
[ 30] 0x0000000004cf0aee E:\Program Files\MATLAB\R2014b\bin\win64\m_dispatcher.dll+00068334 Mfunction_handle::dispatch+00000766
[ 31] 0x0000000004e54a88 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00608904 inPathNotification::function_delete_notification+00297784
[ 32] 0x0000000004e54a04 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00608772 inPathNotification::function_delete_notification+00297652
[ 33] 0x0000000004e549c5 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00608709 inPathNotification::function_delete_notification+00297589
[ 34] 0x0000000004e54992 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00608658 inPathNotification::function_delete_notification+00297538
[ 35] 0x0000000004e54947 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00608583 inPathNotification::function_delete_notification+00297463
[ 36] 0x0000000004dcd69d E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+00054941 inEvalExp+00001309
[ 37] 0x0000000004ef525d E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+01266269 inEvalCmdWithLocalReturn+00000285
[ 38] 0x0000000004ef5181 E:\Program Files\MATLAB\R2014b\bin\win64\m_interpreter.dll+01266049 inEvalCmdWithLocalReturn+00000065
[ 39] 0x000000000636e31d E:\Program Files\MATLAB\R2014b\bin\win64\libmwbridge.dll+00058141 mnGetPrompt+00001517
[ 40] 0x000000000636ed09 E:\Program Files\MATLAB\R2014b\bin\win64\libmwbridge.dll+00060681 mnParser+00000745
[ 41] 0x00000000fd0dd834 E:\Program Files\MATLAB\R2014b\bin\win64\mcr.dll+00383028 mcrInstance::mnParser_on_interpreter_thread+00000036
[ 42] 0x00000000fd0a68e7 E:\Program Files\MATLAB\R2014b\bin\win64\mcr.dll+00157927 mcr::runtime::setInterpreterThreadToCurrent+00019751
[ 43] 0x00000000fd0a6923 E:\Program Files\MATLAB\R2014b\bin\win64\mcr.dll+00157987 mcr::runtime::setInterpreterThreadToCurrent+00019811
[ 44] 0x00000000fd0a7121 E:\Program Files\MATLAB\R2014b\bin\win64\mcr.dll+00160033 mcr::runtime::setInterpreterThreadToCurrent+00021857
[ 45] 0x00000000fab5d3a6 E:\Program Files\MATLAB\R2014b\bin\win64\uiw.dll+00512934 UIW_AttachThreadInput+00001270
[ 46] 0x00000000fab5cc35 E:\Program Files\MATLAB\R2014b\bin\win64\uiw.dll+00511029 wsd_to_MSW+00004373
[ 47] 0x00000000fab5ccb9 E:\Program Files\MATLAB\R2014b\bin\win64\uiw.dll+00511161 wsd_to_MSW+00004505
[ 48] 0x0000000076ba87fe C:\windows\system32\USER32.dll+00165886 GetMenuBarInfo+00000638
[ 49] 0x0000000076b8f5fb C:\windows\system32\USER32.dll+00062971 SystemParametersInfoW+00000235
[ 50] 0x0000000076b94895 C:\windows\system32\USER32.dll+00084117 IsProcessDPIAware+00000465
[ 51] 0x0000000076df11f5 C:\windows\SYSTEM32\ntdll.dll+00332277 KiUserCallbackDispatcher+00000031
[ 52] 0x0000000076b9908a C:\windows\system32\USER32.dll+00102538 PeekMessageW+00000186
[ 53] 0x0000000076b950fe C:\windows\system32\USER32.dll+00086270 GetKeyState+00000238
[ 54] 0x0000000076b93a6f C:\windows\system32\USER32.dll+00080495 PeekMessageA+00000087
[ 55] 0x00000000fab0a26b E:\Program Files\MATLAB\R2014b\bin\win64\uiw.dll+00172651 UIW_ShowMenuItem+00003995
[ 56] 0x00000000fab5dce2 E:\Program Files\MATLAB\R2014b\bin\win64\uiw.dll+00515298 UIW_SuspendAttachThreadInput+00000466
[ 57] 0x0000000100118223 E:\Program Files\MATLAB\R2014b\bin\win64\libmwservices.dll+01212963 services::system_events::PpeDispatchHook::dispatchOne+00032291
[ 58] 0x0000000100123c95 E:\Program Files\MATLAB\R2014b\bin\win64\libmwservices.dll+01260693 sysq::addProcessPendingEventsUnitTestHook+00005813
[ 59] 0x0000000100123d50 E:\Program Files\MATLAB\R2014b\bin\win64\libmwservices.dll+01260880 sysq::addProcessPendingEventsUnitTestHook+00006000
[ 60] 0x0000000100125b75 E:\Program Files\MATLAB\R2014b\bin\win64\libmwservices.dll+01268597 sysq::getCondition+00004629
[ 61] 0x00000001001274ba E:\Program Files\MATLAB\R2014b\bin\win64\libmwservices.dll+01275066 svWS_ProcessPendingEvents+00000138
[ 62] 0x00000000fd0a783d E:\Program Files\MATLAB\R2014b\bin\win64\mcr.dll+00161853 mcr::runtime::setInterpreterThreadToCurrent+00023677
[ 63] 0x00000000fd0a84aa E:\Program Files\MATLAB\R2014b\bin\win64\mcr.dll+00165034 mcr::runtime::setInterpreterThreadToCurrent+00026858
[ 64] 0x00000000fd0a0135 E:\Program Files\MATLAB\R2014b\bin\win64\mcr.dll+00131381 mcr_process_events+00007477
[ 65] 0x00000000fd0a1a12 E:\Program Files\MATLAB\R2014b\bin\win64\mcr.dll+00137746 mcr_process_events+00013842
[ 66] 0x0000000008738f2d E:\Program Files\MATLAB\R2014b\bin\win64\MVMLocal.dll+00167725 mvm_server::inproc::LocalFactory::terminate+00048285
[ 67] 0x00000000fa8ef1ea E:\Program Files\MATLAB\R2014b\bin\win64\mvm.dll+00782826 mvm::detail::initLocalMvmHack+00000490
[ 68] 0x00000000fa8ef7a8 E:\Program Files\MATLAB\R2014b\bin\win64\mvm.dll+00784296 mvm::detail::SessionImpl::privateSession+00000376
[ 69] 0x00000000fa8ef9f8 E:\Program Files\MATLAB\R2014b\bin\win64\mvm.dll+00784888 mvm::detail::SessionImpl::privateSession+00000968
[ 70] 0x0000000140005ddd E:\Program Files\MATLAB\R2014b\bin\win64\MATLAB.exe+00024029
[ 71] 0x0000000140007870 E:\Program Files\MATLAB\R2014b\bin\win64\MATLAB.exe+00030832
[ 72] 0x0000000076c959ed C:\windows\system32\kernel32.dll+00088557 BaseThreadInitThunk+00000013
[ 73] 0x0000000076dcc541 C:\windows\SYSTEM32\ntdll.dll+00181569 RtlUserThreadStart+00000033
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/
A technical support engineer might contact you with further information.
感谢您的帮助。