File Exchange

image thumbnail


version (19.9 KB) by Richard Crozier
C++ class wrapper and utilities

1 Download

Updated 08 Oct 2016

From GitHub

View Version History

View license on GitHub

Header file with C++ class wrapper and other related utilities for creating mex interfaces to C++ objects.
This submission expands on the work done by Oliver Woodford on safely wrapping a persistent C++ object in a classdef wrapper. The supplied header file simplifies the creation of interfaces by providing some preprocessor macros, and a set of utility functions for performing argument checking, conversion between Matlab data types and std data types etc.
A base matlab class (cppinterface.m) is supplied to simplify the creation of your wrapper. This is intended to be subclassed by your classdef interface class.

An example is also provided of allowing two wrapped C++ object to communicate with each other directly through access to their pointers.

Cite As

Richard Crozier (2021). crobarcro/mcode-cpp-utilities (, GitHub. Retrieved .

Comments and Ratings (2)

Richard Crozier

I can offer the code under an alternative licence for a fee, contact me for discussion.

Andrew Ashworth

Any chance of re-licensing this under a more permissive license? Would like to use this at work but there's no chance we'll switch to an open-source license for a collection of utility functions.

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Example MATLAB class wrapper for a C++ class

Community Treasure Hunt

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

Start Hunting!