TCP connection with external software
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
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
Réponses (0)
Voir également
Catégories
En savoir plus sur Interface-Based Instrument Communication dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!