Clear Filters
Clear Filters

reading mat files in C++

3 views (last 30 days)
John Knowles
John Knowles on 26 Jul 2016
Edited: John Knowles on 27 Jul 2016
I would like to compile a console application using the XCode 7.3 GUI. The application would read information from a mat file, and to test it I thought I would try the matlab example diagnose.cpp. It has previously been noted that compiling this outside of Matlab requires specifcation of the path to the libmat.dylib, which in my case is /Applications/MATLAB_R2015b.app/bin/maci64. However I could not find out how to specify this in the Xcode GUI. Any suggestions as to how to do this? I am trying to avoid using the matlab compiler as this results in very slow standalone programs.

Accepted Answer

Wayne Xun
Wayne Xun on 26 Jul 2016
Hi John
I found a tutorial for XCode 7.2. This is a bit older than your version, but hopefully you'll still be able to follow it. TUTORIAL
Hope this helps
  1 Comment
John Knowles
John Knowles on 27 Jul 2016
Edited: John Knowles on 27 Jul 2016
Hi Wayne:
That really helped a lot for the mat functions. I never would have figured that out on my own. Now the strange thing is that I am getting errors for failing to link to what I think are mex API functions, even though, following the tutorial, I linked to the LibMex.dylib library also. I show these errors below. For instance mxDestroyArray is listed in the Mathworks page as a function in Matrix.h. I could not find it in there, but that file consists mainly of pre-processor commands, so it could be included from somewhere else.
Am i interpreting these errors correctly as due to a missing lib file? Is there an easy fix? many thanks,
John
Undefined symbols for architecture x86_64:
"_mxDestroyArray", referenced from:
diagnose(char const*) in Diagnose.o
"_mxFree", referenced from:
diagnose(char const*) in Diagnose.o
"_mxGetNumberOfDimensions_730", referenced from:
diagnose(char const*) in Diagnose.o
"_mxIsFromGlobalWS", referenced from:

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!