您现在的位置是:主页 > news > 明水县网站建设/软件培训机构排名
明水县网站建设/软件培训机构排名
admin2025/5/25 10:51:35【news】
简介明水县网站建设,软件培训机构排名,百度不更新网站,网站建设幽默尝试matlab调用c语言,编译出了.mexw32文件,调用此函数,matlab就崩溃,已经纠结好几天了~~程序是为了对kdd数据集,一列字符类特征进行量化,不想在matlab中使用循环体,可是不善长混合编程:Q#includ…
尝试matlab调用c语言,编译出了.mexw32文件,调用此函数,matlab就崩溃,已经纠结好几天了~~
程序是为了对kdd数据集,一列字符类特征进行量化,不想在matlab中使用循环体,可是不善长混合编程:Q
#include
#include
#include
extern void qtzA(const int x,const char *buf, double *B)
{
B[x]=0.0;
if (strcmp(buf,"icmp")==1) B[x]=1;
else if (strcmp(buf,"tcp")==1) B[x]=2;
else if (strcmp(buf,"udp")==1) B[x]=3;
else B[x]=4;
return;
}
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
mxArray *A;
double *B;
int x;
int subs[2];
int nsubs=2;
int buflen;
char *buf;
int index,status;
int MA,NA,MB,NB;
MA=mxGetM(prhs[0]);
NA=mxGetN(prhs[0]);
MB=MA;
NB=NA;
plhs[0]=mxCreateDoubleMatrix(MB,NB,mxREAL);
for(x=0;x
{
subs[0]=x;
subs[1]=0;
index=mxCalcSingleSubscript(prhs[0],nsubs,subs);
A=mxGetCell(prhs[0],index);
buflen=mxGetM(A)*mxGetN(A)+1;
buf=mxCalloc(buflen,sizeof(char));
status=mxGetString(A,buf,buflen);
qtzA(x,buf,B);
}
B=mxGetPr(plhs[0]);
}
以下是报错,求大牛帮助呀
------------------------------------------------------------------------
Segmentation violation detected at Fri Mar 16 12:46:45 2012
------------------------------------------------------------------------
Configuration:
MATLAB Version: 7.11.0.584 (R2010b)
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_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
Default Encoding: GBK
Fault Count: 1
Abnormal termination:
Register State (from fault):
EAX = 00000000 EBX = 0cadbe18
ECX = 00c2ded0 EDX = 00000000
ESP = 00c2de94 EBP = 00c2de9c
ESI = 00000000 EDI = 00000001
EIP = 7bce2c78 EFL = 00010202
CS = 0000001b DS = 00000023 SS = 00000023
ES = 00000023 FS = 0000003b GS = 00000000
Stack Trace (from fault):
[ 0] 0x7bce2c78 D:/MATLAB/bin/win32/libmx.dll+00011384 ( mxCalcSingleSubscript_730+000008 )
[ 1] 0x7bcf7dd5 D:/MATLAB/bin/win32/libmx.dll+00097749 ( mxCalcSingleSubscript+000037 )
[ 2] 0x03a31166 D:/myfile/qtzB.mexw32+00004454 ( ???+000037 )
[ 3] 0x7b833394 D:/MATLAB/bin/win32/libmex.dll+00013204 ( mexRunMexFile+000132 )
[ 4] 0x7b832199 D:/MATLAB/bin/win32/libmex.dll+00008601 ( inSwapMexfileReader+000201 )
[ 5] 0x7b832391 D:/MATLAB/bin/win32/libmex.dll+00009105 ( inSwapMexfileReader+000705 )
[ 6] 0x7a29b0f9 D:/MATLAB/bin/win32/m_dispatcher.dll+00045305 ( Mfh_file::dispatch_fh+000249 )
[ 7] 0x7a29b384 D:/MATLAB/bin/win32/m_dispatcher.dll+00045956 ( Mfunction_handle::dispatch+000420 )
[ 8] 0x7aa42881 D:/MATLAB/bin/win32/m_interpreter.dll+00534657 ( MathWorks::MException::MExceptionEnvelope::MExceptionEnvelope+384993 )
[ 9] 0x7aa2fc9a D:/MATLAB/bin/win32/m_interpreter.dll+00457882 ( MathWorks::MException::MExceptionEnvelope::MExceptionEnvelope+308218 )
[ 10] 0x7aa24bc9 D:/MATLAB/bin/win32/m_interpreter.dll+00412617 ( MathWorks::MException::MExceptionEnvelope::MExceptionEnvelope+262953 )
[ 11] 0x7ace7eda D:/MATLAB/bin/win32/m_interpreter.dll+03309274 ( TabContext::FindCompletion+003382 )
[ 12] 0x7aa18b10 D:/MATLAB/bin/win32/m_interpreter.dll+00363280 ( MathWorks::MException::MExceptionEnvelope::MExceptionEnvelope+213616 )
[ 13] 0x7aa1b7f1 D:/MATLAB/bin/win32/m_interpreter.dll+00374769 ( MathWorks::MException::MExceptionEnvelope::MExceptionEnvelope+225105 )
[ 14] 0x7aa2542e D:/MATLAB/bin/win32/m_interpreter.dll+00414766 ( MathWorks::MException::MExceptionEnvelope::MExceptionEnvelope+265102 )
[ 15] 0x7aa243f2 D:/MATLAB/bin/win32/m_interpreter.dll+00410610 ( MathWorks::MException::MExceptionEnvelope::MExceptionEnvelope+260946 )
[ 16] 0x7aa2f747 D:/MATLAB/bin/win32/m_interpreter.dll+00456519 ( MathWorks::MException::MExceptionEnvelope::MExceptionEnvelope+306855 )
[ 17] 0x7aa2f7c9 D:/MATLAB/bin/win32/m_interpreter.dll+00456649 ( MathWorks::MException::MExceptionEnvelope::MExceptionEnvelope+306985 )
[ 18] 0x7a29b0f9 D:/MATLAB/bin/win32/m_dispatcher.dll+00045305 ( Mfh_file::dispatch_fh+000249 )
[ 19] 0x7a29b384 D:/MATLAB/bin/win32/m_dispatcher.dll+00045956 ( Mfunction_handle::dispatch+000420 )
[ 20] 0x7aa8f0d6 D:/MATLAB/bin/win32/m_interpreter.dll+00848086 ( inAnonymousFunction+001158 )
[ 21] 0x7aa8fc46 D:/MATLAB/bin/win32/m_interpreter.dll+00851014 ( inMainLoopIdle+000662 )
[ 22] 0x7a9d68d5 D:/MATLAB/bin/win32/m_interpreter.dll+00092373 ( inFullFevalFcn+003445 )
[ 23] 0x7aa9010f D:/MATLAB/bin/win32/m_interpreter.dll+00852239 ( inMainLoopIdle+001887 )
[ 24] 0x7aa90159 D:/MATLAB/bin/win32/m_interpreter.dll+00852313 ( inMainLoopIdle+001961 )
[ 25] 0x7aa9017e D:/MATLAB/bin/win32/m_interpreter.dll+00852350 ( inEvalCmdWithLocalReturn+000030 )
[ 26] 0x78346cd3 D:/MATLAB/bin/win32/libmwbridge.dll+00027859 ( mnInitializeParser+000179 )
[ 27] 0x7834ab3f D:/MATLAB/bin/win32/libmwbridge.dll+00043839 ( mnParser+000495 )
[ 28] 0x7a3eb423 D:/MATLAB/bin/win32/mcr.dll+00177187 ( mcrInstance::mnParser_on_interpreter_thread+000051 )
[ 29] 0x7a3d44c2 D:/MATLAB/bin/win32/mcr.dll+00083138 ( mvm::detail::RecursiveScopedMcrLock::~RecursiveScopedMcrLock+034226 )
[ 30] 0x7a3d4595 D:/MATLAB/bin/win32/mcr.dll+00083349 ( mvm::detail::RecursiveScopedMcrLock::~RecursiveScopedMcrLock+034437 )
[ 31] 0x7a3d2148 D:/MATLAB/bin/win32/mcr.dll+00074056 ( mvm::detail::RecursiveScopedMcrLock::~RecursiveScopedMcrLock+025144 )
[ 32] 0x7b558e81 D:/MATLAB/bin/win32/uiw.dll+00298625 ( UIW_IsUserMessage+000129 )
[ 33] 0x7b55942f D:/MATLAB/bin/win32/uiw.dll+00300079 ( ws_ProcessPendingEventsWaitForWindows+000303 )
[ 34] 0x77d31923 C:/WINDOWS/system32/USER32.dll+00137507 ( UnhookWinEvent+000119 )
[ 35] 0x77d2b317 C:/WINDOWS/system32/USER32.dll+00111383 ( MoveWindow+000121 )
[ 36] 0x77d278d0 C:/WINDOWS/system32/USER32.dll+00096464 ( GetWindowTextLengthW+000154 )
[ 37] 0x7c92e473 C:/WINDOWS/system32/ntdll.dll+00058483 ( KiUserCallbackDispatcher+000019 )
[ 38] 0x7b52e684 D:/MATLAB/bin/win32/uiw.dll+00124548 ( UIW_SetCurrentDialog+000564 )
[ 39] 0x7b52e6df D:/MATLAB/bin/win32/uiw.dll+00124639 ( UIW_SetCurrentDialog+000655 )
[ 40] 0x7b55a545 D:/MATLAB/bin/win32/uiw.dll+00304453 ( ws_FreeSystemFont+000485 )
[ 41] 0x7a0a1b07 D:/MATLAB/bin/win32/libuij.dll+00137991 ( sysq::ws_ppeHook::~ws_ppeHook+006887 )
[ 42] 0x7a0a21da D:/MATLAB/bin/win32/libuij.dll+00139738 ( sysq::ws_ppeHook::~ws_ppeHook+008634 )
[ 43] 0x7a0a3183 D:/MATLAB/bin/win32/libuij.dll+00143747 ( svWS_CommitDatabaseUpdates+002051 )
[ 44] 0x7a0a3a43 D:/MATLAB/bin/win32/libuij.dll+00145987 ( svWS_CommitDatabaseUpdates+004291 )
[ 45] 0x7a0a3c36 D:/MATLAB/bin/win32/libuij.dll+00146486 ( svWS_CommitDatabaseUpdates+004790 )
[ 46] 0x7a0a3d24 D:/MATLAB/bin/win32/libuij.dll+00146724 ( svWS_CommitDatabaseUpdates+005028 )
[ 47] 0x7a0a3ea2 D:/MATLAB/bin/win32/libuij.dll+00147106 ( UIJ_WS_ProcessPendingEvents+000018 )
[ 48] 0x7a3d4e3a D:/MATLAB/bin/win32/mcr.dll+00085562 ( mvm::detail::RecursiveScopedMcrLock::~RecursiveScopedMcrLock+036650 )
[ 49] 0x7a3d506d D:/MATLAB/bin/win32/mcr.dll+00086125 ( mvm::detail::RecursiveScopedMcrLock::~RecursiveScopedMcrLock+037213 )
[ 50] 0x7a3d531c D:/MATLAB/bin/win32/mcr.dll+00086812 ( mcr_invoke_on_interpreter_thread+000220 )
[ 51] 0x7a3d5a4c D:/MATLAB/bin/win32/mcr.dll+00088652 ( mcr_invoke_on_interpreter_thread+002060 )
[ 52] 0x00406202 D:/MATLAB/bin/win32/MATLAB.exe+00025090 ( ???+002060 )
[ 53] 0x004062c5 D:/MATLAB/bin/win32/MATLAB.exe+00025285 ( ???+002060 )
[ 54] 0x0040638d D:/MATLAB/bin/win32/MATLAB.exe+00025485 ( ???+002060 )
[ 55] 0x00406834 D:/MATLAB/bin/win32/MATLAB.exe+00026676 ( ???+002060 )
[ 56] 0x7c817077 C:/WINDOWS/system32/kernel32.dll+00094327 ( RegisterWaitForInputIdle+000073 )
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.