Oscar Esteve wrote:
> If i have:
> //option 1 - it doesn't work
> float *nou;
> nou = (float *) calloc(50, sizeof(float));
> //option 2 - it works
> float nou;
> How can I send "nou" to Matlab if it's a pointer (option 1)??? -
> option 2 works with the code:
> I'm using this code:
> mxArray *TxNou = NULL;
> TxNou = mxCreateNumericMatrix(1, 15, mxSINGLE_CLASS, mxREAL);
> memcpy((void *)mxGetPr(TxNou), (void *)nou, sizeof(nou));
Why not use mxGetData and avoid the cast?
in option 1:
sizeof(nou) = sizeof(float *) = 4 on 32 bit, 8 on 64bit.
In option 2:
sizeof(nou) = 15*sizeof(float) = 15*4 = 60
> matlab.PutVariable("TxNou", TxNou);
> I don't know what changes I have to do in the code - i've tried a lot
> of things... i don't find the error!
> Thanks for your advice,