TCP connection with external software

1 vue (au cours des 30 derniers jours)
Marco Gaetani d'Aragona
Marco Gaetani d'Aragona le 17 Juil 2019
Commenté : Walter Roberson le 17 Juil 2019
Hi to everyone!
I'm experiencing some problems when trying to create a communication between Matlab and OpenSees (a sofware that adopts tcl as programming language) using tcp. In particular I'm able to create the connection adopting this simple script:
clear all;clc
tcpipServer = tcpip('127.0.0.1', 30001,'NetworkRole','server');
fopen(tcpipServer);
X=fread(tcpipServer)
After this command, Matlab stands for the output from the software. Thus, to produce the output, I need to execute the software adopting an external command, and then the output from the software is directly retrieved from matlab.
Now, I need to run the software from the same script instead of using an external command, but if I adopt the following command at the end of the previous script:
system(['OpenSees > source ','Model_joint_pop.tcl'],'-echo');
Matlab does not execute the command until the tcp connection is closed, standing for the output from the connection. Since the software is not executed, Matlab stands for the connection until the timeout is reached. In the same way, if I execute the sofware as a first command, the connection is not found from tcl and the software is aborted.
Is there any solution to execute the software right after the creation of the connection (without executing command as sequential) in order to make Matlab to read the output from the same software?
Thank you in advance.
  3 commentaires
Marco Gaetani d'Aragona
Marco Gaetani d'Aragona le 17 Juil 2019
Modifié(e) : Marco Gaetani d'Aragona le 17 Juil 2019
Hi thank you for the response.
I need to run the software from Matlab and, then, to retrieve and elaborate the output in Matlab. The problem is that Matlab doesn't run a second command (run the external software) before the first is completely terminated (open tcp). Could you please send me the link to the file exchange page? Thanks
Walter Roberson
Walter Roberson le 17 Juil 2019
https://blogs.mathworks.com/pick/2017/06/09/launch-and-manage-external-processes-from-matlab/
https://www.mathworks.com/matlabcentral/fileexchange/13851-popen-read-and-write

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Interface-Based Instrument Communication dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by