Call MATLAB Fuzzy Logic Toolbox function in UNITY3D

I need to use a fuzzy logic function that I’ve made in MATLAB in my UNITY3D project. Can anyone help me please?


I see two options:

[Complicated] Export your Matlab Code as an DLL and use P/Invoke see this:

With the latest Matlab Version it seem to be possible to compile a .Net assembly which could be used within Unity (as long it is compiled to .net version 2.0 or 3.5) See the matlab example:

[Less Complicated] Wrap your Matlab model within a process hosting a network socket and communicate over a UDP Connection, Unity sends input parameters to your matlab process and the matlab process sends outputs to Unity.