Error with mex function

Hello,
I keep receiving the following error and I want to see if anyone can tell me whats wrong. I'm sure its an easy fix I just can't find it. The error I receive from my own code as follows "Error getting T/F from input #2."
The following is part of code concerning this error
SumFile_pr = mxGetField(prhs(ArgNum),1,'WrSumFile')
ErrStat = mxGetString(SumFile_pr, ADOptions%WrSumFile, M*N)
IF (ErrStat /= 0) CALL ProgAbort('Error getting T/F from input #2.')
I use the following as my matlab struct.
ADOptions.WrSumFile = '.False.'
Then using results = mymexfunction(ADOptions, othervariables) in matlab. Any advice is appreciated.

댓글 수: 2

Kaustubha Govind
Kaustubha Govind 2012년 8월 8일
What is ADOptions%WrSumFile supposed to represent? The second argument to mxGetString needs to be a pre-allocated character buffer. See the bottom of the mxGetString help page for examples of usage.
Chris
Chris 2012년 8월 8일
Sorry, I guess the better question is how to copy the '.False.' statement from matlab to the logical variable ADOptions%WrSumFile. Something like a mxCopyPtrToLogical command.

댓글을 달려면 로그인하십시오.

 채택된 답변

James Tursa
James Tursa 2012년 8월 8일

0 개 추천

Reading a MATLAB character string with Fortran syntax logical constants into a Fortran logical variable:
character*20 TF
:
ErrStat = mxGetString(SumFile_Pr, TF, 20)
:
read(TF,*,ERR=___) ADOptions%WrSumFile
Handle the errors appropriately.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Fortran with MATLAB에 대해 자세히 알아보기

질문:

2012년 8월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by