How do I notify a MATLAB object of an event in a Java object?

后端 未结 2 928
萌比男神i
萌比男神i 2021-02-05 06:17

For simplicity, say I have a Java object which generates a random number at randomly spaced time intervals. I wish to have a MATLAB object notified every time one of these rand

2条回答
  •  南方客
    南方客 (楼主)
    2021-02-05 06:32

    I don't know, with java how to communicate with Matlab. But you should use Observable objects. And implements yours. Observer will send "notifications" that something has changed when observable object notify it to the EDT.

    That's called Observable pattern.

    Maybe take a look : https://docs.oracle.com/javase/7/docs/api/java/util/Observer.html

    Best regards.

提交回复
热议问题