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

11 Ansichten (letzte 30 Tage)
Peter Loksa
Peter Loksa am 20 Apr. 2018
Kommentiert: Walter Roberson am 7 Apr. 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 Kommentare
Walter Roberson
Walter Roberson am 20 Apr. 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 am 20 Apr. 2018
Yes, communication needs to be 2 directional.
Operating system is Win10 64bit.
I think static length is enough.
Many thanks.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 20 Apr. 2018
Bearbeitet: Walter Roberson am 20 Apr. 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 Kommentare
cr
cr am 7 Apr. 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 am 7 Apr. 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Wireless Communications finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by