Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!z28g2000vbl.googlegroups.com!not-for-mail
From: John Harrold <john.m.harrold@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: mexCallMATLAB populating inputs
Date: Wed, 19 Aug 2009 18:03:22 -0700 (PDT)
Organization: http://groups.google.com
Lines: 25
Message-ID: <add8f90f-3a82-4810-9437-666b0eb17d0b@z28g2000vbl.googlegroups.com>
References: <70c8e2ce-c34a-454e-8c40-d186e7aa61b4@s6g2000vbp.googlegroups.com> 
	<494fa8a2-72c1-4c6a-a599-69269928edd2@r27g2000vbn.googlegroups.com> 
	<h6i5vn$kj9$1@fred.mathworks.com>
NNTP-Posting-Host: 72.88.75.190
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1250730202 21513 127.0.0.1 (20 Aug 2009 01:03:22 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 20 Aug 2009 01:03:22 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: z28g2000vbl.googlegroups.com; posting-host=72.88.75.190; 
	posting-account=22diBQoAAAAD5i1tJbtrsS2fX2hlob6K
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; 
	rv:1.9.1.2) Gecko/20090729 Firefox/3.0.5, Ant.com Toolbar 
	1.2,gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:564620


On Aug 19, 8:39 pm, "James Tursa"
<aclassyguy_with_a_k_not_...@hotmail.com> wrote:
> John Harrold <john.m.harr...@gmail.com> wrote in message <494fa8a2-72c1-4c6a-a599-69269928e...@r27g2000vbn.googlegroups.com>...
>
> > What syntax in C would allow me to populate the prhs1 array such that
> > I could subsequently call the mexCallMATLAB function?
>
>   double a[] = {1, 2, 3, 4};
>   double *pr;
>   mxArray *plhs1[1], *prhs1;
>   int i;
>   prhs1 = mxCreateDoubleMatrix(4, 1, mxREAL);
>   pr = mxGetPr(prhs1);

I think this is what I couldn't figure out.


> For readability, you might consider making plhs1 and prhs1 either both arrays or both pointers. That way using them for arguments in mexCallMATLAB would look the same instead of different as I have them above.

Yeah, you're right.

Thanks for your help this is exactly what I needed.