How to set UDP communication in Matlab applications?

15 次查看(过去 30 天)
Hello everyone! I am trying to create two Matlab applications using appdesigner. First one should have TextArea and Button, and when Button is pushed, text from TextArea should be sent to another app and be shown in another app's TextArea. Communication between two apps should be done using udpport. That is the problem I can't solve. Can anyone help me? Be free to attach your solutions! (I am using R2024b, and applications should be on one machine)

回答(1 个)

Walter Roberson
Walter Roberson 2024-12-20,19:19
%first application
system('matlab -batch SecondApplication() &');
pause(10);
u = udpport();
write(u, 1:5, "uint8", "127.0.0.1", 43219);
%second application
u = udpport(LocalPort=43219);
data = read(u, 5, "uint8");

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by