Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
5c2b1f98
Commit
5c2b1f98
authored
Apr 21, 2016
by
Davis King
Browse files
Fixed an error where some assignments to matrix output variables would result
in an exception getting thrown.
parent
060e876b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
6 deletions
+29
-6
dlib/matlab/mex_wrapper.cpp
dlib/matlab/mex_wrapper.cpp
+29
-6
No files found.
dlib/matlab/mex_wrapper.cpp
View file @
5c2b1f98
...
...
@@ -1044,9 +1044,20 @@ namespace mex_binding
matrix_colmajor
&
item
)
{
// 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
(
!
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
(
...
...
@@ -1054,9 +1065,21 @@ namespace mex_binding
fmatrix_colmajor
&
item
)
{
// 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
(
!
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
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment