0

I have the following Matlab code in myMatlabClass.m:

classdef myMatlabClass < handle
properties
  value
end

methods
   function obj = myMatlabClass()
      obj.value = 0;
   end

   function value = getValue(obj)
      value = obj.value;
   end

   function setValue(obj, newValue)
      obj.valu = newValue;
   end
end

I'm trying to call these functions from C after compiling this code using Matlab compiler (mcc). The issue is, mcc will only create a C function for the file, not for the member functions:

bool MW_CALL_CONV mlxmyMatlabClass(int nlhs, mxArray *plhs[], int nrhs, mxArray 
                                     *prhs[]);

and an equivalent vararg-version.

I suppose, this function will create an object (haven't tried yet). -

Is it possible to call the object's member functions from C?

  • How are you creating the C code? With `codegen` or `mcc`? Please clarify in your question (what command do you run?) and tag appropriately. – horchler Jan 13 '14 at 17:54
  • 1
    @horchler: `mlx` and `mlf` prefixed functions are probably the result of using the MATLAB Compiler (`mcc`). As far as I know, you cannot compile MATLAB classes into equivalent C++ classes, you can only generate functional interfaces for each method... – Amro Jan 13 '14 at 18:09

0 Answers0