Prev: cross diagonal enteries
Next: Trying to start a MatLab Engine (engOpen) setting a startup directory in Windows from C code
From: Etienne on 12 Aug 2010 13:36 Hi Folks I have used James Tursa's excellent toolbox recently for linking fortran mex files to Matlab in Windows, but now I am having problems compiling with gfortran. The problem is with the follwing line CALL MatlabAPI_COM_Apx3(%VAL(mxGetPr(UDOTPSF8ptr2)), 1, D3 ) and the compiler is complainign about the %VAL statement. I am not sure what I need to change to get it to work. Any help would be appreciated. Thanks Etienne
From: Steven_Lord on 12 Aug 2010 14:49 "Etienne" <etienne.coetzee(a)airbus.com> wrote in message news:i41be3$mgn$1(a)fred.mathworks.com... > Hi Folks > > I have used James Tursa's excellent toolbox recently for linking fortran > mex files to Matlab in Windows, but now I am having problems compiling > with gfortran. The problem is with the follwing line > > CALL MatlabAPI_COM_Apx3(%VAL(mxGetPr(UDOTPSF8ptr2)), 1, D3 ) > > and the compiler is complainign about the %VAL statement. I am not sure > what I need to change to get it to work. Can you be more explicit about what the compiler is saying when it complains? -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: James Tursa on 12 Aug 2010 14:54 "Etienne" <etienne.coetzee(a)airbus.com> wrote in message <i41be3$mgn$1(a)fred.mathworks.com>... > Hi Folks > > I have used James Tursa's excellent toolbox recently for linking fortran mex files to Matlab in Windows, but now I am having problems compiling with gfortran. The problem is with the follwing line > > CALL MatlabAPI_COM_Apx3(%VAL(mxGetPr(UDOTPSF8ptr2)), 1, D3 ) > > and the compiler is complainign about the %VAL statement. I am not sure what I need to change to get it to work. > > Any help would be appreciated. > > Thanks > > Etienne I am not familiar with gfortran. %VAL is non-standard Fortran usage for passing by value. Is there another mechanism available in gfortran for passing by value? e.g., is the VALUE attribute available? James Tursa
From: Etienne on 13 Aug 2010 07:27 Hi Steve and James Basically the compiler says that the %VAL is not recognised. I guess I would like to know how I can get rid of the call to the subroutine MatlabAPI_COM_Apx1. When I look in the subroutine it receives the value of the array which is provided by the %VAL statement, which refers to a pointer. I am trying to copy the values of an array back to an object in Matlab. The code I am using is below. The question is how I can get rid of the call to MatlabAPI_COM_Apx1? Regards Etienne ============================================= C Assign Mtot values -------------- MTOTF7ptr1=mxGetProperty(PLHS(1),1,'Mtot') C IF( MTOTF7ptr1 == 0 ) THEN CALL mexErrMsgTxt("Property Mtot not found") ENDIF C M=SIZE(MTOTF7) D1=M MTOTF7ptr2 = mxCreateNumericArray(1,D1,mxClassIDFromClassName('dou &ble'),0) CALL MatlabAPI_COM_Apx1(%VAL(mxGetPr(MTOTF7ptr2)), 1, D1 ) MTOTF7MWS => Apx1 IF( .NOT.ASSOCIATED(MTOTF7MWS) ) THEN CALL mexErrMsgTxt("Internal error pointing to Mtot pointer data" &) ENDIF C DO I=1,M MTOTF7MWS(I)=MTOTF7(I) ENDDO C CALL mxSetProperty(PLHS(1),1,'Mtot',MTOTF7ptr2) CALL mxDestroyArray(MTOTF7ptr2) CALL mxDestroyArray(MTOTF7ptr1) C
From: Steven_Lord on 13 Aug 2010 09:31
"Etienne" <etienne.coetzee(a)airbus.com> wrote in message news:i43a68$cpk$1(a)fred.mathworks.com... > Hi Steve and James > > Basically the compiler says that the %VAL is not recognised. I'll leave the Fortran debugging to James, as he's better at it. Just a note about best practice for posting to CSSM: when you're asking for help with an error (whether it be a runtime or a compilation error) you should post the EXACT text of the error message, not (just) what you believe it means. Sometimes the full text of an error message includes details that the person asking the question may have overlooked or may not have strong enough technical knowledge to interpret the subtleties. For example, the solution to the problem where the compiler give the error: %VAL is an undefined symbol. is likely to be very different from the solution to the problem where the compiler throws the error: %VLA is an undefined symbol. but a quick read through of the message might overlook the misspelling in the latter message, and both are likely to be summarized "%VAL is not recognized". -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com |