问题
I'm trying to get data from a server. Right now, I am polling the server every couple of seconds for the current values. I am wondering if it is possible to have Matlab get the data in real-time or if I am stuck with my current implementation. Has anyone done anything like this? If so, maybe you can tell me how you got started with it.
Any help would be greatly appreciated. Thanks!
回答1:
If you're on Windows, you can listen to ActiveX (COM) events using REGISTEREVENT. You would need to provide an ActiveX control (servers might work too, I'm not sure) that triggers the event, which would invoke your MATLAB function.
回答2:
Matlab timers work well for periodic events. You'll want to be careful about making sure your function executes in less time than the periodicity of the timer, though settings for the behavior when that doesn't hold do exist.
来源:https://stackoverflow.com/questions/1504168/real-time-data-in-matlab