Matlab: Intefacing with External Program

In summary, the conversation discusses the desire to interface an external chess engine program with MATLAB. The program can be run in a DOS window and responds to commands such as 'isready' with string responses. The individual is seeking a way to send commands to the program from MATLAB and receive responses within MATLAB. A link is provided for a potential solution, but the individual would prefer to directly message the program rather than specifying coordinates for input. Furthermore, the individual also needs to be able to read the text responses from the program.
  • #1
I_am_learning
682
16
I have an external program (A chess engine) that I want to interface with matlab. If I double-click the Engine.exe, it runs in a dos window. I can then type in commands like
'isready' and it responds with string such as 'ready'. I want to send command to it from MATLAB and receive the response in matlab.
Anyone knows how to do it?
I am using Windows.
 
Physics news on Phys.org
  • #3
Yeah! I won't be passing arguments while starting the program. The program will be running separately (doing its calculations). I just want to communicate with it time to time. Your link shows way to type into any running windows program. Thats fine. But it would be more better if I could directly message the program instead of having to specify the co-ordinate for the input field of the program.
Moreover, I also need to read back the text-answer produced by the program.
 

FAQ: Matlab: Intefacing with External Program

What is Matlab and how does it interface with external programs?

Matlab is a powerful programming language and numerical computing environment used in various scientific and engineering fields. It allows for the creation and manipulation of matrices and arrays, as well as the implementation of various mathematical and statistical algorithms. Matlab can interface with external programs through various methods such as system calls, file input/output, and API calls.

Why would I want to interface Matlab with an external program?

There are many reasons why one may want to interface Matlab with an external program. Some common reasons include the need to use specialized tools or libraries not available in Matlab, the need to process large amounts of data or perform complex calculations, and the need to integrate Matlab with other software or hardware systems.

What are some common methods for interfacing Matlab with an external program?

As mentioned before, there are several methods for interfacing Matlab with an external program. Some common methods include using system calls to execute external programs, using file input/output to read and write data between Matlab and external programs, and using API calls to access functions and data from external programs.

How do I use system calls to interface Matlab with an external program?

To use system calls, you can use the built-in "system" function in Matlab. This function allows you to execute external programs or system commands from within your Matlab code. You can also use the "unix" or "dos" functions depending on your operating system. These functions return the output of the external program or command as a string variable, which you can then process in your Matlab code.

Are there any limitations or things to consider when interfacing Matlab with an external program?

Yes, there are a few things to consider when interfacing Matlab with an external program. First, you need to ensure that the external program is compatible with Matlab, as well as the operating system you are using. Additionally, you need to consider the performance impact of interfacing with an external program, as it may slow down your Matlab code. It's also important to handle errors and exceptions that may occur when interfacing with external programs.

Similar threads

Replies
9
Views
3K
Replies
2
Views
1K
Replies
3
Views
2K
Replies
5
Views
2K
Replies
1
Views
1K
Replies
4
Views
3K
Replies
4
Views
3K
Back
Top