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

2 次查看(过去 30 天)
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 Code Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by