Search code examples
c++matlab-enginematlab

"??? Undefined function or method" in Matlab Engine command window


I am working with Visual Studio on C++ code, and I send some variables to MATLAB engine. So far there is no problem. Imagine I have the MATLAB command window opened and these variables:

» whos
  Name            Size             Bytes  Class     Attributes

  QWe             1x365             2920  double              
  QWp             1x364             2912  double              
  QWu             1x364             2912  double 

I can use the standard MATLAB functions, but I have dowloaded a new function.m (which works in MATLAB normally after setting the path) that this command window from MATLAB's engine is not recognizing or finding.

» isnormq(Q)
??? Undefined function or method 'isnormq'

I thought they (command window and MATLAB) were synchronized but now I see they aren't.

How can I solve this so I can use my function.m from the command window? Any help will be welcomed.


Solution

  • As it has been a long time and nobody answered I will post what I did:

    In Matlab everytime you need a newtoolbox you link the path once and there stays "forever". You can use functions from the toolbox as if they were by default in Matlab.

    Using matlab engine this doesn't work that way so it is necessary to write the command line:

    % Here we load the toolbox for converting quaternion to Euler Angles
    addpath(genpath('C:\Program Files (x86)\MATLAB\R2010a\toolbox\SpinCalc')); //for example