Example MATLAB class wrapper for a C++ class

バージョン 1.4.1 (5.07 KB) 作成者: Oliver Woodford
An example of how to safely encapsulate a C++ class in a MATLAB class, via a mex interface.
ダウンロード: 8.2K
更新 2023/2/15

編集メモ: This file was selected as MATLAB Central Pick of the Week

This package provides an example of how to wrap a C++ class in a MATLAB class, via a mex interface, safely, without memory leaks, whilst achieving an interface in MATLAB that is similar to the underlying C++ interface.
After downloading, call:
>> run_example
in MATLAB to see an example implementation in action.

Look in run_example.m, example_mex.cpp (and optionally example_interface.m if you don't want to use the standard interface) to see how this is implemented, and copy the structure to interface with your own C++ classes.

This submission is inspired by the following newsgroup thread:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/278243
Thanks to all those who have contributed.

引用

Oliver Woodford (2024). Example MATLAB class wrapper for a C++ class (https://github.com/ojwoodford/mex_class_wrapper/releases/tag/v1.4.1), GitHub. に取得済み.

MATLAB リリースの互換性
作成: R2012b
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersCall C++ from MATLAB についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.4.1

See release notes for this release on GitHub: https://github.com/ojwoodford/mex_class_wrapper/releases/tag/v1.4.1

1.4.0.0

Added a standard interface to avoid needing an interface class per mex wrapper. Also added an example script.

1.3.0.0

Add #includes suggested by Richard Crozier (thanks) to fix compilation in Linux.

1.2.0.0

2nd attempt to fix compilation under linux.

1.1.0.0

Fix compile error in Linux - thanks to Andreas for highlighting the issue.

1.0.0.0

この GitHub アドオンでの問題を表示または報告するには、GitHub リポジトリにアクセスしてください。
この GitHub アドオンでの問題を表示または報告するには、GitHub リポジトリにアクセスしてください。