フィルターのクリア

Error with mex function

3 ビュー (過去 30 日間)
Chris
Chris 2012 年 8 月 7 日
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 日
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.
  1 件のコメント
Chris
Chris 2012 年 8 月 9 日
Thanks James

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFortran with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by