Unexpected unknown exception from MEX file..

7 次查看(过去 30 天)
Hey,
I wrote my bottleneck function as a mex function and it works well so far, but at a sudden point in my programm I just get a "Unexpected unknown exception from MEX file.." error.
I already found out that this happens when some of the input arrays exceed a certain length, but since I cant put any break points I dont know where the error exactly appears.
The function looks like following:
function [A]=function_name(a,b,c,d,e,f,g)
'a'
a'=NaN(length(a),1);
'b'
b'=NaN(length(a),1);
'c'
c'=NaN(length(a),1);
'd'
parfor i=1:length(a)
n=d(:,i);
n_d=a(n);
n_r=b(n);
dia=a(e);
rho=b(e)
[a'(i),b'(i)]some_other_function(n_d,n_r,dia,rho,e,f,g)
end
'j'
end
The error always seems to occur when the nx1 arrays a and b and the nxn loical matrix c exceed the size of about n=44000.
I put some letters in the code that should be displayed after a line is executed, I hoped that I could figure out where the error occurs since I cant put breakpoints anymore when its a mex function.
But it seems that I dont even get to the 'a' line in the iteration when the error occurs. My last display is 'j', which is the last output of the previpous error-free iteration, and then I get "Unexpected unknown exception from MEX file..", nothing more, only that it is this function where it happens.
Since I dont even get an 'a' displayed, I dont think that it is the overhead of variables a and b, the error muts happen when calling the function and the reason must be something with the input size of the variabkes a,b and c... but I dont know how to proceed further to find out whats going wrong.
Maybe somebody coukld give me a hint how to find out whats happening here
If you need the original code, I can provide it, but I prefer to not do so since its about my Phd research.
Many thanks in advance
Best regards.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by