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: mexCallMATLAB crashes in loops?
Replies: 12   Last Post: Jan 3, 2013 1:49 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 6
Registered: 12/28/12
Re: mexCallMATLAB crashes in loops?
Posted: Jan 2, 2013 5:36 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Thank you, James. Actually I only need one of the structure element each time for the function input, and I was messing up when setting the field values for the incall.

I fixed the code in this way:


for(ifield=0; ifield<nfields; ifield++){
mxSetFieldByNumber(incall[0], 0, ifield, tmp);

I got some ideas from this thread:

So I cleaned the mout[0] in each loop and cleaned the incall[0] in the end. The code works for now yet I still have a question:

Is it necessary to clean the mout[0] in the loop? Can I clean it up in the end of the code (with incall[0])?

Thank you again for your helpful replies :)

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.