Commit 5c2b1f98 authored by Davis King's avatar Davis King

Fixed an error where some assignments to matrix output variables would result

in an exception getting thrown.
parent 060e876b
......@@ -1043,21 +1043,44 @@ namespace mex_binding
mxArray*& plhs,
matrix_colmajor& item
)
{
if(!item._private_is_persistent())
{
// Don't need to do a copy if it's this kind of matrix since we can just
// pull the underlying mxArray out directly and thus avoid a copy.
plhs = item._private_release_mxArray();
}
else
{
plhs = mxCreateDoubleMatrix(item.nr(),
item.nc(),
mxREAL);
if (item.size() != 0)
memcpy(mxGetPr(plhs), &item(0,0), item.size()*sizeof(double));
}
}
void assign_to_matlab(
mxArray*& plhs,
fmatrix_colmajor& item
)
{
if(!item._private_is_persistent())
{
// Don't need to do a copy if it's this kind of matrix since we can just
// pull the underlying mxArray out directly and thus avoid a copy.
plhs = item._private_release_mxArray();
}
else
{
plhs = mxCreateNumericMatrix(item.nr(),
item.nc(),
mxSINGLE_CLASS,
mxREAL);
if (item.size() != 0)
memcpy(mxGetPr(plhs), &item(0,0), item.size()*sizeof(float));
}
}
void assign_to_matlab(
mxArray*& plhs,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment