Home > Archive > Matlab > November 2005 > Returning an array with doubles and chars from mex
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 |
Returning an array with doubles and chars from mex
|
|
| Brian Elmegaard 2005-11-29, 4:03 am |
| Hi
I would like to return an array containg different data types from
mex. It works with the following code:
[snip]
v=1.0;
a=mxCreateDoubleMatrix(1,1,mxREAL);
ap=mxGetPr(a);
ap[0]=v;
plhs[0] = mxCreateCellMatrix(10, 2);
for(line = 0; line < numlines; line++) {
mxSetCell(plhs[0], line, mxCreateString(strarray[line]));
mxSetCell(plhs[0], line+10, mxCreateDoubleScalar(v));
[snap]
but it returns [1] for all the doubles and I have not found a way to
get it without the brackets. Isn't that possible?
tia,
--
Brian (remove the sport for mail)
http://www.et.web.mek.dtu.dk/Staff/be/be.html
http://www.rugbyklubben-speed.dk
| |
| Christopher Hulbert 2005-11-29, 8:00 am |
| Brian Elmegaard wrote:
> Hi
>
> I would like to return an array containg different data types from
> mex. It works with the following code:
>
>
> [snip]
> v=1.0;
> a=mxCreateDoubleMatrix(1,1,mxREAL);
> ap=mxGetPr(a);
> ap[0]=v;
>
> plhs[0] = mxCreateCellMatrix(10, 2);
> for(line = 0; line < numlines; line++) {
> mxSetCell(plhs[0], line, mxCreateString(strarray[line]));
> mxSetCell(plhs[0], line+10, mxCreateDoubleScalar(v));
> [snap]
>
> but it returns [1] for all the doubles and I have not found a way to
> get it without the brackets. Isn't that possible?
>
> tia,
Isn't v always 1.0?
|
|
|
|
|