Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
0af81bb5
Commit
0af81bb5
authored
Feb 10, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in 10 argument version of call_matlab() and also cleaned up a few
minor things.
parent
2dbb860b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
call_matlab.h
dlib/matlab/call_matlab.h
+4
-0
mex_wrapper.cpp
dlib/matlab/mex_wrapper.cpp
+10
-2
matrix_data_layout.h
dlib/matrix/matrix_data_layout.h
+2
-0
No files found.
dlib/matlab/call_matlab.h
View file @
0af81bb5
...
...
@@ -30,6 +30,9 @@ class matlab_struct
To get the values as C++ types you do something like this:
int val = mystruct["field"];
or
int val;
mystruct["field"].get(val);
See also example_mex_struct.cpp for an example that uses this part of the API.
!*/
...
...
@@ -53,6 +56,7 @@ private:
sub
()
:
struct_handle
(
0
),
field_idx
(
-
1
)
{}
template
<
typename
T
>
operator
T
()
const
;
template
<
typename
T
>
void
get
(
T
&
item
)
const
;
template
<
typename
T
>
sub
&
operator
=
(
const
T
&
new_val
);
const
sub
operator
[]
(
const
std
::
string
&
name
)
const
;
sub
operator
[]
(
const
std
::
string
&
name
);
...
...
dlib/matlab/mex_wrapper.cpp
View file @
0af81bb5
...
...
@@ -2292,6 +2292,7 @@ void call_matlab (
setup_input_args
(
prhs
[
nrhs
],
A6
,
nrhs
);
setup_input_args
(
prhs
[
nrhs
],
A7
,
nrhs
);
setup_input_args
(
prhs
[
nrhs
],
A8
,
nrhs
);
setup_input_args
(
prhs
[
nrhs
],
A9
,
nrhs
);
setup_input_args
(
prhs
[
nrhs
],
A10
,
nrhs
);
const
int
nlhs
=
num_args
-
nrhs
;
...
...
@@ -2306,6 +2307,7 @@ void call_matlab (
setup_output_args
(
function_name
,
plhs
[
i
],
A6
,
i
);
setup_output_args
(
function_name
,
plhs
[
i
],
A7
,
i
);
setup_output_args
(
function_name
,
plhs
[
i
],
A8
,
i
);
setup_output_args
(
function_name
,
plhs
[
i
],
A9
,
i
);
setup_output_args
(
function_name
,
plhs
[
i
],
A10
,
i
);
free_callback_resources
<
T1
>
(
nlhs
,
plhs
,
nrhs
,
prhs
);
...
...
@@ -2316,6 +2318,14 @@ void call_matlab (
template
<
typename
T
>
matlab_struct
::
sub
::
operator
T
()
const
{
T
item
;
get
(
item
);
return
item
;
}
template
<
typename
T
>
void
matlab_struct
::
sub
::
get
(
T
&
item
)
const
{
if
(
struct_handle
==
0
)
throw
dlib
::
error
(
"Attempt to access data in an empty struct."
);
...
...
@@ -2324,7 +2334,6 @@ matlab_struct::sub::operator T() const
if
(
temp
==
0
)
throw
dlib
::
error
(
"Attempt to access data in an empty struct."
);
T
item
;
try
{
mex_binding
::
validate_and_populate_arg
(
0
,
temp
,
item
);
...
...
@@ -2336,7 +2345,6 @@ matlab_struct::sub::operator T() const
<<
endl
<<
e
.
msg
;
throw
dlib
::
error
(
sout
.
str
());
}
return
item
;
}
const
matlab_struct
::
sub
matlab_struct
::
...
...
dlib/matrix/matrix_data_layout.h
View file @
0af81bb5
...
...
@@ -1027,6 +1027,7 @@ namespace dlib
void
_private_mark_non_persistent
()
{
DLIB_CASSERT
(
mem
==
0
,
"You can't convert a persistent matlab array to non-persistent."
);
make_persistent
=
false
;
}
...
...
@@ -1148,6 +1149,7 @@ namespace dlib
void
_private_mark_non_persistent
()
{
DLIB_CASSERT
(
mem
==
0
,
"You can't convert a persistent matlab array to non-persistent."
);
make_persistent
=
false
;
}
...
...
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