Problems in using matlab engine.

In summary, the individual is experiencing execution errors when trying to call MATLAB from C code. The errors are related to undefined references to engine functions, even though the header file "engine.h" has been included. The individual asks for help in solving the issue and Kerry suggests checking the C and MATLAB code to ensure the correct calls are being made.
  • #1
beanlet
6
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
  • #2
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
 
  • #3


Hello,

I understand that you are experiencing issues with using the MATLAB engine in your C code. This can be a common problem, but there are a few things you can check to resolve it.

First, make sure that you have properly linked the MATLAB engine library to your C code. This can be done by adding the "-leng" option to your linker command.

Also, double check that you have included the "libeng.lib" file in your project. This file contains the definitions for the engine functions that your code is unable to find.

Another possible solution is to make sure that you are using the correct version of the MATLAB engine for your operating system. If you are using a 64-bit operating system, make sure you are using the 64-bit version of the engine.

If these solutions do not work, it may be helpful to check online forums or reach out to the MATLAB support team for further assistance. Good luck!
 

Related to Problems in using matlab engine.

1. What are some common problems that can occur when using the MATLAB engine?

Some common problems when using the MATLAB engine include compatibility issues with different versions of MATLAB, incorrect syntax or function calls in the code, and insufficient memory allocation for large datasets or computations.

2. How can I troubleshoot errors when using the MATLAB engine?

To troubleshoot errors, it is important to carefully check the code for any syntax or function call errors. It can also be helpful to refer to the MATLAB documentation or online forums for solutions to common problems. Additionally, checking for updates or reinstalling the MATLAB engine may resolve some issues.

3. Why am I getting a "library not found" error when trying to use the MATLAB engine?

This error can occur if the path to the MATLAB library is not properly set up. Make sure to add the path to the MATLAB library to your system's PATH variable or set the LD_LIBRARY_PATH environment variable.

4. Can I use the MATLAB engine with other programming languages?

Yes, the MATLAB engine can be used with other programming languages such as C, C++, Java, and Python. However, the steps for integrating the engine may differ depending on the language and platform being used.

5. How can I optimize the performance of the MATLAB engine?

To optimize performance, it is important to use efficient coding practices and minimize unnecessary function calls. It can also be helpful to allocate enough memory for the engine and use vectorized operations instead of loops whenever possible.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
8K
Replies
61
Views
1K
  • Programming and Computer Science
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • Programming and Computer Science
Replies
9
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
5K
  • Programming and Computer Science
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
Back
Top