【文件属性】:
文件名称:matlab如何敲代码-mcwrap:从MATLAB调用C/C++函数而无需担心MEX
文件大小:16KB
文件格式:ZIP
更新时间:2021-05-23 09:37:32
系统开源
matlab如何敲代码mcwrap
从MATLAB调用C
/
C
++函数,而不用担心MEX。
这是一个matlab程序,它使用用户提供的最小语法自动生成和编译MEX代码。
(请注意,不再支持直接fortran包装。而是使用C包装fortran,然后应用mcwrap。)
入门
确保已设置兼容MATLAB的C
++编译器。
只需CD进入示例目录并运行测试程序
这是C
++的最小示例(未显示源文件)
#
ifndef
reverse_it_h
#
define
reverse_it_h
/*
*
MCWRAP
[
X_out[1,N]
]
=
reverse_it(
X_in[1,N]
)
*
SET_INPUT
N
=
size(X_in,2)
*
SOURCES
reverse_it.cpp
*
HEADERS
reverse_it.h
*/
//
reverse
the
order
of
a
vector
void
reverse_it
(
int
N,
double
*X_out,
double
*X_in);
#
endif
注释中的MCWRAP语法告诉mcwrap如何进行包装。
【文件预览】:
mcwrap-master
----mcwrap_create_json.m(14KB)
----mcwrap.m(13KB)
----templates()
--------cpp_template.cpp(8KB)
--------mfile_template.m(479B)
----run_examples.m(84B)
----license_parse_json.txt(2KB)
----LICENCE.txt(1KB)
----parse_json.m(5KB)
----examples()
--------example1_cpp()
--------example3_cpp_complex()
----README.md(2KB)