#include "fintrf.h" SUBROUTINE mexFunction(nlhs, plhs, nrhs, prhs) IMPLICIT NONE mwPointer plhs(*), prhs(*) integer nlhs, nrhs mwPointer mxGetPr mwPointer mxGetM mwPointer mxCreateDoubleMatrix mwPointer P1,P2,P3 REAL*8 R1,R2,R3 %R1 is integer number
%R2(R1,1) - size of R2
%R3(R1-2,11) - size of R3
P1 = mxGetPr(prhs(1)) P2 = mxGetPr(prhs(2)) CALL mxCopyPtrToREAL8(P1,R1,1) CALL mxCopyPtrToREAL8(P2,R2,1) plhs(1) = mxCreateDoubleMatrix(M-2,11,0) P3 = mxGetPr(plhs(1)) CALL ProgramName(R1,R2,R3) CALL mxCopyREAL8ToPtr(R3,P3,(M-2)*11) return end
This program has 2 input parameters: R1 and R2. Dimensions R2 = R2 (R1). Output parameter R3 has dimensions R3 (R1-2, 11). How can I implement this?
Best Answer