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

3 次查看(过去 30 天)
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 个评论
Walter Roberson
Walter Roberson 2018-4-20
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 2018-4-20
Yes, communication needs to be 2 directional.
Operating system is Win10 64bit.
I think static length is enough.
Many thanks.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2018-4-20
编辑:Walter Roberson 2018-4-20

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 个评论
cr
cr 2020-4-7
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 2020-4-7
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by