Inter-process communication between Matlab script and C++ application

4 visualizaciones (últimos 30 días)
Peter Loksa
Peter Loksa el 20 de Abr. de 2018
Comentada: Walter Roberson el 7 de Abr. de 2020
Hello,
I would like to establish inter-process communication between MATLAB script and some local in-C++-written program. But I would like to avoid communication via file on HDD.
Is the only possible solution like 127.0.0.1? But no matter of that, how can I do it in MATLAB?
Any ideas, hints, methods, keywords?
PL.
  2 comentarios
Walter Roberson
Walter Roberson el 20 de Abr. de 2018
Portable code or is operating system specific acceptable? If so which os?
Do you need to send "messages" of varying length, or between different hosts, or would a shared memory segment work?
Does the communication need to be 2 directional?
Peter Loksa
Peter Loksa el 20 de Abr. de 2018
Yes, communication needs to be 2 directional.
Operating system is Win10 64bit.
I think static length is enough.
Many thanks.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 20 de Abr. de 2018
Editada: Walter Roberson el 20 de Abr. de 2018

See https://www.mathworks.com/matlabcentral/fileexchange/28572-sharedmatrix

The facility is implemented in C (or C++?), and involves creating a shared memory segment using operating system facilities. Your C++ code can do the same. You might potentially need a bit of work to communicate share keys if you generate them dynamically (as would be needed if you want to be able to have multiple independent clients.)

  2 comentarios
cr
cr el 7 de Abr. de 2020
The sharedmatrix programme no longer seems to work. (wondering if MW made clandestine changes with an intention to kill it). Any idea if anyone got it working on versions later than 2016? Or any similar alternatives?
Thanks.
Walter Roberson
Walter Roberson el 7 de Abr. de 2020
I would be rather surprised if Mathworks gave any thought to deliberately disabling the contribution.
I would think that it is simply much more likely that the changes to the headers of variables is leading to problems. The headers were changed in order to permit interleaved complex arrays. Interweaved complex arrays store the real part of a number and then the imaginary part in the next memory location; that is the representation used by the high performance calculation libraries, so the change was done to improve calculation performance.
I suspect that compiling for separate complex is required. https://www.mathworks.com/help/matlab/matlab_external/matlab-support-for-interleaved-complex.html and use the -r2017b flag.

Iniciar sesión para comentar.

Categorías

Más información sobre Programming en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by