Fixed a problem where output matrices don't get assigned anything when they

are empty, leading to MATLAB complaining about output arguments to being
assigned.
This commit is contained in:
Davis King 2016-08-29 14:15:24 -04:00
parent 24b037d569
commit 7f697b420f

View File

@ -1054,6 +1054,12 @@ namespace mex_binding
// 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();
// If there isn't anything there because the matrix is empty then set it to an
// empty matrix.
if (!plhs)
plhs = mxCreateDoubleMatrix(item.nr(),
item.nc(),
mxREAL);
}
else
{
@ -1075,6 +1081,13 @@ namespace mex_binding
// 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();
// If there isn't anything there because the matrix is empty then set it to an
// empty matrix.
if (!plhs)
plhs = mxCreateNumericMatrix(item.nr(),
item.nc(),
mxSINGLE_CLASS,
mxREAL);
}
else
{