KGhadiri
KGhadiri

Reputation: 49

Sending data from MATLAB to Processing in real time?

Is there any way to send strings from one code to another while they're both running on the same machine? I'm trying to collect information using MATLAB and send a string whenever an event triggers. On Processing, I'm waiting for the string to be received before updating a GUI. I've been able to get both codes to work separately, but I'm having trouble figuring out how to actually send the information. Is it more viable to rebuild the GUI in Matlab?

Upvotes: 1

Views: 113

Answers (1)

anon
anon

Reputation:

Depending on the speed requirements of the real time communication, a low tech way of doing this is to use a common file where Matlab writes time-stamped data and Processing periodically checks the file for new data.

This is one way of doing interprocess communication between two independently running processes. Another, more reliable way, is to use some kind of socket communication (tcp or udp sockets, for example) between the two processes. But programming this might be fairly complicated if you are not fluent with both Matlab and Java.

A third way is that Matlab is actually capable of running Java code directly. So if you can call the Processing code from Matlab, then you might be able to pass the strings directly to your Processing code using Java method arguments, etc.

Upvotes: 2

Related Questions