Hello,
i have an exe file (called file.exe), i would like to open it from MATLAB, and insert the commands i wish to execute, i have them in a txt file (called insert.txt).
i was reading on the system command but i can't seem to understnad how to use it corectlly. i tried servel ways but i always get an error
is there any one that know how to adress this? the exe and the txt file both in the same folder as the matlab script, and i'm reading them both using matlab command, not by hand. i also tried it mannualy and it didn't work.
Thnak you !

댓글 수: 8

Rik
Rik 2021년 4월 7일
The system function allows you to call the command line of the OS. That means you need to find a way to run your function with the windows command prompt. Then you can use that syntax in Matlab.
eden meirovich
eden meirovich 2021년 4월 7일
you mean when i use system, i can only use the cmd i'm using from my desktop?
can i use my exe file using fopen maybe?
DGM
DGM 2021년 4월 7일
편집: DGM 2021년 4월 7일
Ignoring Matlab for a moment, what is file.exe and how is it invoked and used? If you can open up a console and use file.exe from the command line, then you can use system() to do the same. If it can't be invoked from the console, how do you run it? Is the problem that it requires user interaction after being launched? Does it have a GUI? What OS?
eden meirovich
eden meirovich 2021년 4월 7일
it's a file i wish to exam the output. i don't quite sure how can i run exe file from the console, do u know how to do that?
Rik
Rik 2021년 4월 7일
How do you run that program normally with the txt file? Do you just double-click?
eden meirovich
eden meirovich 2021년 4월 7일
yes i open it by click on it and then insert the txt manualy. now i'm triyng to do that in a smart way, beacuse i need to do it to more files in the future.
Rik
Rik 2021년 4월 7일
You need to be able to run it through the command line. If you can't, Matlab is no use to you.
You can open up the command line prompt by holding the Windows key and hitting R. Then you can type cmd and hit enter. If you can find a way to run your mysterious program from that interface, you will be able to use it in Matlab.
You can try a Google search to see if there is a command line interface available for your program.
DGM
DGM 2021년 4월 7일
Having a CLI would be ideal, but even if it's a GUI, I imagine there are still roundabout ways to automate simple keyboard and mouse inputs, but the main point is that you'd need to use tools other than Matlab to do it. For example, if you can write a shell script to open the app and feed it text, then you can call that script from Matlab via system().
Doing that in windows isn't something I would know how to do.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

태그

질문:

2021년 4월 7일

댓글:

DGM
2021년 4월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by