The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Passing function arguments to Matlab via Matlab Engine
Replies: 1   Last Post: Jan 29, 2013 1:26 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
James Tursa

Posts: 2,326
Registered: 8/5/09
Re: Passing function arguments to Matlab via Matlab Engine
Posted: Jan 29, 2013 1:26 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"mayur" wrote in message <ke88sc$q9$>...
> I did the following which i am not sure if its correct .. please help..
> A = mxCreateNumericMatrix(1,1,mxDOUBLE_CLASS,mxREAL); // created a numeric matrix of size 1 and of type double
> memcpy(&A,&Amp,sizeof(double)); // copied over the memory from the input argument over to the mxArray..

The above line is an error. What you have done is copy the value of Amp into the first 8 bytes of the mxArray structure of A. What you *want* to do is copy the value into the *data* area of A instead. E.g.,

*mxGetPr(A) = Amp;

or using memcpy:


James Tursa

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.