how to save data into and get data out of mwArray?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I recently compiled a m code into a C++ shared library for the first time. I am trying to call this Matlab-generated code in my C++ project. Then I found this mwArray type which I have zero experience.
_declspec (dllexport) void contourcGenerate(double *c, double *image2DArray, int imageWidth, int imageHeight, double contourLevel)
{
// Must declare all MATLAB data types after initializing the
// application and the library, or their constructors will fail.
mwArray im(1,imageWidth*imageHeight,mxDOUBLE_CLASS);
mwArray a(1,1,mxDOUBLE_CLASS);
mwArray result;
//create the input data
im.SetData(image2DArray,imageWidth*imageHeight);
a.SetData(&contourLevel,1);
// call matlab-generated code
generateContour(1, result,im,a,a);
//Get data out
result.GetData(c,150);
}
It errors out when calling 'generateContour'. Here is the error code
- First-chance exception at 0x7533C41F: Microsoft C++ exception: MathWorks::mcl::mclUserException at memory location 0x0018F12C.
- First-chance exception at 0x7533C41F: Microsoft C++ exception: MathWorks::mcl::mclUserException at memory location 0x0018F12C.
- First-chance exception at 0x7533C41F: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
- First-chance exception at 0x7533C41F: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
- First-chance exception at 0x7533C41F: Microsoft C++ exception: NullPointerException at memory location 0x0018F27C.
- First-chance exception at 0x7533C41F: Microsoft C++ exception: NullPointerException at memory location 0x0018F27C.
- First-chance exception at 0x7533C41F: Microsoft C++ exception: mwException at memory location 0x0018F2D8.
- First-chance exception at 0x7533C41F: Microsoft C++ exception: mwException at memory location 0x0018F2D8.
- Unhandled exception at at 0x7533C41F: Microsoft C++ exception: mwException at memory location 0x0018F2D8.
I don't know whether this is because I did not use those mwArrays correctly. HELP PLZ.
2 Kommentare
Jan
am 26 Jul. 2013
"it did not work, some memory leak issue" is not precise enough. Please provide all information you know to make answering as easy as possible. Thanks.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Deploy to C++ Applications Using mwArray API (C++03) 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!