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

1 view (last 30 days)
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!

Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!