PDA

View Full Version : Mat file API using C++ and Qt



pmathia0
7th April 2016, 08:36
Hi,
I have problem running "Read MAT-File in C/C++" from Matlab examples.
https://www.mathworks.com/help/matlab/matlab_external/creating-a-mat-file-in-c.html

When I compile it from matlab command window using mex, everythink is ok, mat file is created.
When I use the same msvc compiler parameters in command line, everything works fine.
When I create simple console application in VS2015 and setup the project to use mat-file api (includes, libs), everything works.

However, when I try to setup my QT application project to use mat-file api, it builds, but running the app gives me this error:11858

Is there some problem with conversion from Unicode? I read some article that Qt is abandoning ICU converters.
https://wiki.qt.io/Qt-5-ICU

Can anyone please help?

d_stranz
7th April 2016, 16:14
The icu DLLs are in my Qt 5.5 distribution, they are not in the Qt 5.6 distribution, so apparently your reading is correct. This is true for both MSVC2013 and MSVC2015 Qt distributions.

- Are you building everything in 64-bit mode (the error message refers to a library in a "win64" directory)?

- Are you building and linking everything in either Release or Debug modes? You cannot mix-and-match in Windows.

- Were the Matlab DLLs built using VS2015? Try switching your own build to use the VS 2013 platform toolset. (Properties->Configuration->General in VS2015)

- Install Qt 5.5 and try the build from that. You can have multiple Qt distributions installed. Tell VS which one to use from the Qt5 plugin options and project settings. You'll also need to adjust your PATH to load the right DLLs at runtime.

pmathia0
7th April 2016, 19:32
wow, that missing ICU DLLs might be the problem...
I'm building everything in 64bit mode (there's no 32bit Matlab 2016a), paying attention for Debug/Release mode. However, I have no idea how Matlab DLLs were build. Matlab's DLLs are in my system path (work's great with my console application as I mentioned in my post).
I'm installing qt5.5 now and msvc2013 qt libs.
I have no option right now to select VS2013 platform toolset in my VS2015. Do I need to install VS2013 for that?

d_stranz
8th April 2016, 01:55
I have no option right now to select VS2013 platform toolset in my VS2015. Do I need to install VS2013 for that?

I didn't think so, but I can't tell you for certain since I have both of them installed. I thought it was something built into VS2015 to allow you to target different toolsets, like Android, for example. Maybe that is something to ask Google.

pmathia0
8th April 2016, 08:47
I installed VS 2013, too and now I have that option in VS2015...

So, I tried qt5.6 with vs2013, qt5.5 with vs2013, but the error is still there :(
I could try mingw (there are matlab libs for both msvc and mingw)
Today I'm also gonna install and try that with older version of Matlab.

If nothing of that will work, I'll use .csv files instead of .mat

Thank you for your help! :)