For Programmers: Free Programming Magazines  


Home > Archive > Matlab > March 2006 > Passing cell array from Mex to Matlab









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Passing cell array from Mex to Matlab
amser99

2006-03-31, 1:28 pm

Hello,

I have trouble of passing my output "*yinterp" in form of cell array from my mex file into Matlab. I have read the "phonebook.c" example in Matlab Help, and tried to use the following:
double *yinterp;
mxArray *yah;
mxSetCell(plhs[0],24*i+j, mxDuplicateArray(yah));
where:
plhs[0]=mxCreateCellArray(2,dims);
yah = mxCreateDoubleMatrix(1,7991,mxREAL);
yinterp = mxGetPr(yah);

The Mex file did compile successfully. However, when I ran the file in matlab, it crashed. I'm pretty sure that that problem is in the mxSetCell. Probably it does not write the values to plhs[0] as I expected.
I would really appreciate if someone could give me some help. Thanks a lot.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com