View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

Be the first to rate this file! 3 Downloads (last 30 days) File Size: 7.92 KB File ID: #42212 Version: 1.0
image thumbnail



James Tursa (view profile)


This C routine puts a shared data copy of a variable into a workspace from a mex routine

| Watch this File

File Information

This submission is intended for C mex programmers who have a familiarity with the copy-on-write & shared data copy mechanism of MATLAB.

The official mex routine mexPutVariable puts a deep data copy of a variable into a workspace directly from a mex function (without using the plhs return facility). If you are working with very large variables this deep copy can be undesirable. The enclosed function mexPutVariableSharedDataCopy acts like mexPutVariable, but it puts a shared data copy of the variable instead of a deep data copy.

Enclosed is the function file itself, a header file for the function, and a test routine (with associated m-file for self-building).

This function uses unofficial techniques to hack into the mxArray variable header values directly. As such, it is not guaranteed to work on all platforms or with all MATLAB versions. It has only been tested on a few 32-bit Windows platforms.

MATLAB release MATLAB 7.3 (R2006b)
Other requirements Any C compiler, such as the supplied lcc compiler. The test routine is self-building.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.

Contact us