I'd like to have a block in simulink that serves as a tcp server. Ideally the simulation would block when it hits this block, wait until data was transfered to it by the client, and than pass that data out to be used in that step of the simulation. I'd also like the connection to persist across function calls, if possible.
I got this to work in Matlab pretty easily, using the myConnectionObject=tcpip(.)
and fread(..)
functions. So I figured I could just initialize the connection in the workspace, wrap my freads() into a MATLAB function block in Simulink and I'd be on my way.
However, I'm having trouble getting the tcpip connection object into the function to be visible in Simulink so I can use it with fread(). Passing it through a "From Workspace" block gives an "Unsupported input format..." error.
Thanks,