Problems in using matlab engine.

  • Context: MATLAB 
  • Thread starter Thread starter beanlet
  • Start date Start date
  • Tags Tags
    Engine Matlab
Click For Summary
SUMMARY

The discussion centers on execution errors encountered when calling MATLAB from C code, specifically referencing undefined references to functions such as `engOpen`, `engPutVariable`, and `engEvalString`. The user included the header file "engine.h" but still faced linking issues. The problem arises from incorrect function calls being made in MATLAB instead of C, as pointed out by another user, Kerry. This indicates a misunderstanding of the integration process between MATLAB and C.

PREREQUISITES
  • Familiarity with MATLAB C API functions
  • Understanding of C programming and linking errors
  • Knowledge of compiling C code with MATLAB engine libraries
  • Experience with using header files in C
NEXT STEPS
  • Review MATLAB C API documentation for proper function usage
  • Learn how to compile C code with MATLAB engine libraries
  • Investigate linking options in your C compiler for MATLAB integration
  • Explore examples of successful MATLAB and C integration projects
USEFUL FOR

Software developers, particularly those integrating MATLAB with C, and anyone troubleshooting MATLAB engine linking errors.

beanlet
Messages
6
Reaction score
0
Hey,

I have been trying to call MATLAB from C code, but now I have bunch of execution errors here:
===================================================
engine_FFT.o: In function `main':
engine_FFT.c:(.text+0x103): undefined reference to `engOpen'
engine_FFT.c:(.text+0x195): undefined reference to `engPutVariable'
engine_FFT.c:(.text+0x1a7): undefined reference to `engPutVariable'
engine_FFT.c:(.text+0x1b6): undefined reference to `engEvalString'
engine_FFT.c:(.text+0x1c5): undefined reference to `engEvalString'
engine_FFT.c:(.text+0x1d4): undefined reference to `engEvalString'
engine_FFT.c:(.text+0x1e3): undefined reference to `engEvalString'
engine_FFT.c:(.text+0x21b): undefined reference to `engEvalString'
mex: link of 'engine_FFT.mexa64' failed.
====================================================
I already include the header file "engine.h" at the very beginning, how come the code cannot even find out these engine-related functions?

Does anyone see this kind of error message before? How to solve the problem?

Thanks a lot.
 
Physics news on Phys.org
Can you post your C code and your MATLAB code? It looks like you're trying to make calls in MATLAB that you should be making in C.

-Kerry
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 1 ·
Replies
1
Views
9K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K