Re: errors in sample mex files?
- From: "Steve Amphlett" <Firstname.Lastname@xxxxxxxxxxxxxxxx>
- Date: Mon, 17 Jul 2006 04:56:34 -0400
Praetorian wrote:
help.
Rick wrote:
I am trying to learn how to use MEX files.
I think some of Matlab's examples are wrong, which doesn't
beenheading.
eg in file mxcalcsinglesubscript.c, part of it says:
/* Check data type of first input argument */
if (!mxIsDouble(prhs[0])) {
mexErrMsgTxt("First input argument must be a double.");
}
/* Check data type of first second argument */
if (!mxIsDouble(prhs[0]) || mxIsComplex(prhs[0])) {
mexErrMsgTxt("Second input argument must be a real double.");
}
It looks like someone hadn't finished editing the 2nd comment
Also the index to prhs in the 2nd group of statements should be1, shouldn't it?
There are similar statements elsewhere in the file.
Either this file has multiple errors (and should never have
in the
distribution), or I don't understand this whole business.
please tell me - which is it?
Rick
Hi, I don't have much experience with MEX files but I''ve written a
lot
of S-Functions in C and what you say seems to be correct. The
second
input should be prhs[1].
I think the second error check is superfluous anyway. The code boils
down to this:
if(x) error();
if(x || y) error();
What's the point in testing the first condition again? I also think
the comment is plain wrong:
/* Check data type of first second argument */
What is a "first second argument"? Looks like a case of over-zealous
cutting and pasting to me.
.
- References:
- errors in sample mex files?
- From: Rick
- Re: errors in sample mex files?
- From: Praetorian
- errors in sample mex files?
- Prev by Date: Re: mex optimization question
- Next by Date: How to find phase shift
- Previous by thread: Re: errors in sample mex files?
- Next by thread: Re: errors in sample mex files?
- Index(es):
Relevant Pages
|