calling mexw64 function second time goes wrong

When I call my myPET3copy.mexw64 function, the first time goes well but the second time goes wrong.
>> input=[.42,.1,400.,.085,6000,.675,1500.,.125,.125,300.,14.,.54,2.57,.33,.0003];
>> output=myPET3copy(input)
output =
1.0e+05 *
0.0600 0.0000 0.0150 0.0518 0.0000 1.1861 0.0005 0.0000
>> output=myPET3copy(input)
output =
6002 NaN 1500 NaN NaN NaN NaN NaN
following is my mexfunction
#include "fintrf.h"
subroutine mexFunction(nlhs,plhs,nrhs,prhs)
implicit none
mwPointer plhs(*),prhs(*)
integer*4 nlhs,nrhs
mwPointer mxGetPr
mwPointer mxCreateDoubleMatrix
!integer*4 mxIsNumeric
mwPointer mxGetM,mxGetN
mwPointer input_ptr,output_ptr
mwPointer mrows,ncols
mwSize size
COMMON/PAR/INPUT(15),OUTPUT(8)
real(kind=8) INPUT,OUTPUT
mwSize :: ONE=1,EIGHT=8
integer :: ComplexFlag=0
mrows=mxGetM(prhs(1))
ncols=mxGetN(prhs(1))
size=mrows*ncols
input_ptr=mxGetPr(prhs(1))
call mxCopyPtrToReal8(input_ptr,INPUT,size)
plhs(1)=mxCreateDoubleMatrix(ONE,EIGHT,ComplexFlag)
output_ptr=mxGetPr(plhs(1))
call myPET3()
call mxCopyReal8ToPtr(output,output_ptr,EIGHT)
return
end
Why could it be like this?

回答(0 个)

类别

帮助中心File Exchange 中查找有关 MATLAB Compiler 的更多信息

提问:

2020-11-29

Community Treasure Hunt

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

Start Hunting!

Translated by