Accessing an mxarray when using codeGen to convert Matlab DLL to mex

조회 수: 1 (최근 30일)
Ajay Kumar
Ajay Kumar 2016년 3월 15일
편집: Ajay Kumar 2016년 3월 18일
Hello!
I have a *.DLL that performs some data modification on a vector:
calllib( 'DLL64', 'CPP', pX, pY)
Where pX and pY are pointers to the input and output respectively.
In order to grab the data from pY, I had initially used:
for n = 0:outLen-1
pYn = pY + n;
outVal(1+n, 1) = pYn.value;
end
When I run this through the codeGen, I had an issue with pointer increment:
??? Integers can only be combined with integers of the same class, or scalar doubles.
Turns out that pX is a mxArray. I am certain that I am reading this incorrectly. But, gave it a shot anyway:
I added a coder.extrinsic
coder.extrinsic('mxGetData');
Then I attempted to collect the data as follows:
if coder.target('MATLAB')
for n=0:outLen-1
pYn = pY + n;
outVal(1+n, 1) = pYn.value;
end
else
outVal = zeros(outLen-1, 1);
outVal = mxGetData(pY);
end
Is there any way I could increment the pointer without offending the codeGen?
It errors during codeGen. Any help is appreciated! Thank you!

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by