[app designer] Create callback function when a variable changed.

Hello I am here to find help
I want to make a simple app which containing a Lamp in app designer.
That Lamp turns green when this app connected with other app by TCP/IP.
And when TCP/IP connection is disconnected, the Lamp turns to be red.
I think it is possible by some kind of callback function called when TCP/IP connection check value is changed.
How can I make it?

4 件のコメント

Geoff Hayes
Geoff Hayes 2021 年 12 月 17 日
@Jae-Hee Park - how are you creating the TCP/IP connection to another app? How does your App know about the other?
Jae-Hee Park
Jae-Hee Park 2021 年 12 月 20 日
App1 create tcp/ip server by matlab functions like this
t = tcpserver(address,port);
and App2 connect like this
client = tcpclient(address,port);
Geoff Hayes
Geoff Hayes 2021 年 12 月 20 日
@Jae-Hee Park - you might be able to use the ErrorOccurredFcn callback to capture if there is an error and from that you might be able to assume that the connection is lost. I couldn't see a function that might check the state of the connection. There might be one, but it wasn't obvious to me.
Jae-Hee Park
Jae-Hee Park 2021 年 12 月 21 日
@Geoff Hayes how about this way? "ConnectionChangedFcn"

サインインしてコメントする。

その他の回答 (0 件)

質問済み:

2021 年 12 月 15 日

回答済み:

2021 年 12 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by