Reading data from matlab files into C

前端 未结 1 901
被撕碎了的回忆
被撕碎了的回忆 2020-12-19 04:59

I\'m trying to learn how to use the C API to reading Matlab .mat files, but it\'s not working as I expected:

I\'d like to just open a very simple

相关标签:
1条回答
  • 2020-12-19 05:24

    This is a linker failure, not a compiler failure (and is unrelated to -I compiler option). You need to specify the directory in which the matlab .so files are located using -L flag and add a -l<matlab-lib-name> option to end of the compiler command that specifies the name of the matlab library.

    For example:

    cc -I/usr/local/MATLAB/R2011a/extern/include/ -L/usr/local/MATLAB/R2011a/lib animate_shot.c -o animate_shot -lmatlab

    (I don't know the exact directory into the which .so are located or the name of the matlab library)


    Based on the comment providing further information:

    cc -I/usr/local/MATLAB/R2011a/extern/include/ -L/usr/local/MATLAB/R2011a/bin/glnxa64 animate_shot.c -o animate_shot -lmat -lmx

    0 讨论(0)
提交回复
热议问题