필터 지우기
필터 지우기

Avoid Copying MEX array to C Struct

조회 수: 2 (최근 30일)
Andrew
Andrew 2014년 8월 8일
답변: Jan 2014년 8월 10일
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