Avoid Copying MEX array to C Struct

2 次查看(过去 30 天)
I am new to MEX. From the "phonebook.c" example, it appears that copying is required from prhs[] to a C struct . . . using either memcpy() or mxDuplicateArray().
In my case, prhs[] will be very large, (megabytes). Copying is not ideal.
Is there a way, using MEX commands, to set a pointer to a C struct to prhs[] and avoid copying??
Thanks in advance.

采纳的回答

Jan
Jan 2014-8-10
The array duplication is only required, when an input array is modified and replied as output. In all other cases you can use the pointer to the array data inside the Mex file also without any problems.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Write C Functions Callable from MATLAB (MEX Files) 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by