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

조회 수: 5 (최근 30일)
Peter Loksa
Peter Loksa 2018년 4월 20일
댓글: Walter Roberson 2020년 4월 7일
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