Filter löschen
Filter löschen

Avoid Copying MEX array to C Struct

2 Ansichten (letzte 30 Tage)
Andrew
Andrew am 8 Aug. 2014
Beantwortet: Jan am 10 Aug. 2014
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.

Akzeptierte Antwort

Jan
Jan am 10 Aug. 2014
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.

Weitere Antworten (0)

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by