Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Using mexGetVariablePtr and mexGetVariable
Date: Sat, 14 Jun 2008 23:12:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 37
Message-ID: <g31j81$jnu$1@fred.mathworks.com>
References: <g312r1$sdq$1@fred.mathworks.com> <g317s9$3sm$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1213485121 20222 172.30.248.37 (14 Jun 2008 23:12:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 14 Jun 2008 23:12:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1140690
Xref: news.mathworks.com comp.soft-sys.matlab:473824



"Sebastiaan " <s.breedveld@erasmusmc.REMOVE.BOO.BOO.nl>
wrote in message <g317s9$3sm$1@fred.mathworks.com>...
> > 
> > #include "mex.h"
> > 
> > void mexFunction(int nlhs, mxArray *plhs,
> > int nrhs, mxArray *prhs[])
> First of all, which Matlab version are you using? The
> correct function call is:
> 
> void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const
> mxArray* prhs[])
> 
> (at least, for a number of versions).
> > mexPrintf("myarray  %d  | alpha  %d  |  ho1  %d", myarray,
> > alpha, ho1);
> 
> The bug is here. The variable is recorded correctly, but it
> is a double, while printed as a integer. Use %f instead.
> 
> Btw: to prevent your code from crashing, check if
> myarray!=0, e.g.:
> 
> if (myarray==NULL)
>   mexErrMsgTxt("Variable hullo not initialized\n")
> 
> Greetings,
> Sebastiaan
> 




thanks, that was it, I just posted some instructions on mex
file multithreading (I needed the above help for a
multithreading prog I was writing) here:
http://www.instructables.com/id/Matlab-Multithreading-EASY/