use matlab to interact with external program?

7 次查看(过去 30 天)
Hi
Is it possible to have MATLAB interact with an external application by not only receiving input from it but running some calculations on that input and then sending output back to the program to control it in real time as though MATLAB is the user?
I want to make a robot that controls a game, but the game must be external to MATLAB.
Thanks!

回答(1 个)

Walter Roberson
Walter Roberson 2016-10-23
It sounds to me as if what you need is for MATLAB to talk to the robot . The robot would have sensors (video almost certainly, possibly audio as well) that would have to be sent back to MATLAB, and would have control surfaces of some kind that would be activated by MATLAB -- but MATLAB would not be connecting to the game, MATLAB would be connecting to the robot.
There are a number of packages are appropriate, including Raspberry Pi, Arduino, and a couple of robotics devices.
  2 个评论
Lewis
Lewis 2016-10-23
Well when I said robot I was thinking more along the lines of software written in MATLAB that controls the game, rather than actual hardware. I would open up the game and MATLAB on the same computer and then run the program for MATLAB to start playing the game. Something like that.
Walter Roberson
Walter Roberson 2016-10-23
编辑:Walter Roberson 2016-10-23
Java Robot Class can be used to click buttons and press keys.
Getting information back from a graphics executable is tricky. You would need to find the executable's window handle (HWND) and ask to get the graphics buffer associated, and analyze that buffer.
I do not know the restrictions on one program fetching another's graphics buffers in MS Windows. In the general case it is not possible because of anti-copying measures for DVD and CD (if you could get the graphics then you could take a perfect digital copy of a DVD at that resolution, which hardware and copyright protection is designed to prevent.) But that is the general case, and there could potentially be exceptions, such as if the second process was started under the debugger.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 ROS Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by