- Home /
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?
Answer by xflagx · Mar 07, 2017 at 10:40 PM
Hy,
I see two options:
[Complicated] Export your Matlab Code as an DLL and use P/Invoke see this: http://www.snowbolt.com/index.php/blog/28-tech/91-pinvoke
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: https://de.mathworks.com/help/compiler_sdk/ml_code/create-a-net-component-from-matlab-code.html
[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.
Your answer
![](https://koobas.hobune.stream/wayback/20220612112517im_/https://answers.unity.com/themes/thub/images/avi.jpg)