C MEX file: can the right side point to the same thing as the left side?

Discussion in 'MATLAB' started by Dan Siegal, Jul 8, 2004.

  1. Dan Siegal

    Dan Siegal Guest

    hello all,

    i'm trying to write a C MEX file, and i'm wondering if i can have the
    input to the function and the output point to the same thing, i.e.

    foo = mxGetScalar(prhs[0]);
    func(foo);
    foo = mxGetScalar(prhs[0]);

    or something like that. is something like this possible?

    thanks,
    dan
     
    Dan Siegal, Jul 8, 2004
    #1
    1. Advertisements

  2. Hi Dan,

    you probably meant foo=mxGetScalar(plhs[0]); in the third line of your code?
    If so, the answer is yes, why not. The function just copies the first value
    of the
    array to foo, you can do this as often as you like ;-)

    Titus
     
    Titus Edelhofer, Jul 8, 2004
    #2
    1. Advertisements

  3. Dan Siegal

    Dan Siegal Guest

    you probably meant foo=mxGetScalar(plhs[0]); in the third line of
    that's correct. :) that's what i meant to write.

    thanks,
    dan
     
    Dan Siegal, Jul 8, 2004
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.