MATLAB encountered an internal error and needs to close -MEX file
Ältere Kommentare anzeigen
I debugged my code based on Mathwork post https://www.mathworks.com/help/matlab/matlab_external/debugging-on-microsoft-windows-platforms.html and crashed MATLAB. This my code:
#include "fintrf.h"
subroutine mexFunction(nlhs, plhs, nrhs, prhs) ! Interface
IMPLICIT REAL*8(A-H,O-Z)
mwpointer plhs(*), prhs(*)
C integer nlhs, nrhs
mwpointer mxCreateDoubleMatrix, mxGetPr
double precision mxGetScalar
C Pointers to input/output mxArrays:
mwPointer TT
C Get the size of the input array.
m_in = 20
n_in = 1
size = m_in * n_in
C Create Fortran array from the input argument.
C IZ = mxGetScalar(prhs(1));
C EEAR = mxGetScalar(prhs(2));
C DDIA = mxGetScalar(prhs(3));
C RRPM = mxGetScalar(prhs(4));
NN = mxGetScalar(prhs(1));
C Create matrix for the return argument.
plhs(1) = mxCreateDoubleMatrix(m_in, n_in, 0)
TT = mxGetPr(plhs(1))
call LOOPS1(%VAL(TT),%VAL(NN)) ! call the computation
return
end
subroutine LOOPS1(TT, nn)
IMPLICIT REAL*8(A-H,O-Z)
n1 = nn+1
call LOOPS(TT, n1)
return
end
The error is in the line (n1 = nn+1). I don't know what the problem is. Please help me.
1 Kommentar
iman AHMADI
am 13 Okt. 2016
Akzeptierte Antwort
Weitere Antworten (1)
iman AHMADI
am 14 Okt. 2016
Bearbeitet: iman AHMADI
am 14 Okt. 2016
1 Kommentar
James Tursa
am 14 Okt. 2016
I am not sure I understand the problem. You show the following for how you are calling the function:
f=0.2;image(fn)
If "image" is the name of your mex routine and you want to get both outputs back to the workspace, you need to call it with two outputs (just like you would call any other function that has two outputs). E.g.,
f=0.2;
[out1,out2] = image(fn); % <-- provide two variable names to store the result
Kategorien
Mehr zu Fortran Source MEX Files finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!