Interprocess communication with Matlab on Windows

I am creating a game in Unity3D that integrates with some code in Matlab. I am looking for a one way communication channel from Unity3D to Matlab on the same computer.

The message is a short string.

The frequency of these messages is very low.

Example:

  • I am running my game in Unity3D.

  • At the beginning Unity3D sends 'message1'

    to Matlab

  • After 30 seconds Unity3D sends 'message2'

    to Matlab

  • After 30 seconds Unity3D sends 'message3'

    to Matlab

I know my programming knowledge is not advanced enough to do it myself. I am doing delicate research work and need advice on where to focus my efforts. I don't need any kind of authentication protocol because I am just using one computer.

Based on my description above, what IPC do you think I should use and why? I need a direction to focus my work on because I'm not very advanced.

  • DLL for sharing memory between two processes

  • TCP sockets

  • UDP sockets (what's the difference with TCP socket in my case?)

  • (I can't use named pipes because Unity3D doesn't support it.)

+3


source to share


1 answer


What you want to use is the MATLAB API. see: http://www.mathworks.com/help/matlab/calling-matlab-engine-from-cc-and-fortran-programs.html?refresh=true



And there is a very nice detailed demo posted here: http://www.umiacs.umd.edu/~jsp/Downloads/MatlabEngine/MatlabEngine.pdf I tested it and it worked!

0


source







All Articles