[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #48949] mexCallMATLABWithTrap not implemented
From: |
Guillaume |
Subject: |
[Octave-bug-tracker] [bug #48949] mexCallMATLABWithTrap not implemented and problem with mexCallMATLAB/mexSetTrapFlag |
Date: |
Tue, 30 Aug 2016 10:42:34 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0 |
URL:
<http://savannah.gnu.org/bugs/?48949>
Summary: mexCallMATLABWithTrap not implemented and problem
with mexCallMATLAB/mexSetTrapFlag
Project: GNU Octave
Submitted by: gyom
Submitted on: Tue 30 Aug 2016 10:42:32 AM GMT
Category: Libraries
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Feature Request
Status: None
Assigned to: None
Originator Name: Guillaume
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
It seems that mexCallMATLABWithTrap is not available from the Octave API:
http://www.mathworks.com/help/matlab/apiref/mexcallmatlabwithtrap.html
I tried instead to use mexCallMATLAB with mexSetTrapFlag, even if its use is
deprecated in MATLAB, as it seems to be implemented in Octave:
http://www.mathworks.com/help/matlab/apiref/mexsettrapflag.html
There seems to be an issue with the integer value returned by mexCallMATLAB
though:
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
int sts;
mexSetTrapFlag(1); /* or 0 */
sts = mexCallMATLAB(0, NULL, 1, (mxArray **)prhs, "fileread");
mexPrintf("status = %d.\n", sts);
}
With mexSetTrapFlag(0), Octave gives:
octave:1> test_mexCallMATLAB('e')
error: fileread: cannot open file
error: called from
fileread at line 37 column 5
With mexSetTrapFlag(0), MATLAB gives:
>> test_mexCallMATLAB('e')
Error using fileread (line 49)
Could not open file e. No such file or directory.
With mexSetTrapFlag(1), Octave gives:
octave:1> test_mexCallMATLAB('e')
error: fileread: cannot open file
status = 0.
With mexSetTrapFlag(1), MATLAB gives:
>> test_mexCallMATLAB('e')
Error using fileread (line 49)
Could not open file e. No such file or directory.
status = 1.
So it seems that when the Trap Flag is set to true, mexCallMATLAB is not set
to a non-zero value when an error is caught.
>From what I see, it seems that having an implementation of
mexCallMATLABWithTrap might not be too difficult - the main issue being that
MException is not implemented: what are the plans regarding this and should it
be implemented in M-code or C++?
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?48949>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #48949] mexCallMATLABWithTrap not implemented and problem with mexCallMATLAB/mexSetTrapFlag,
Guillaume <=