Running via matlab command an .exe file and putting direct the input in cmd

5 vues (au cours des 30 derniers jours)
Ivan Mich
Ivan Mich le 2 Avr 2020
Hello,
I have a question about a code. First of all, I would like to execute an .exe file via matlab command.
I am using the command
system('C:\Users\HP\Desktop\file.exe &') in order to run it.
After the execution of this file cmd window opens and I have to put the input file that needs in order to run this program.
My question is can I put the input file direct with a matlab command and as a result to run it without cmd window opens?
Thank you
  4 commentaires
Fangjun Jiang
Fangjun Jiang le 2 Avr 2020
In Cmd window, after the .exe is started, did you type in like "c:\MyDocu\inputdata.txt" and hit return, or you have to navigate the hard drive and pick and choose?
Ivan Mich
Ivan Mich le 2 Avr 2020
I have to type the file (eg file.txt) after the .exe started

Connectez-vous pour commenter.

Réponses (1)

Fangjun Jiang
Fangjun Jiang le 2 Avr 2020
Modifié(e) : Fangjun Jiang le 2 Avr 2020
Create a text file called "InputString.txt". Inside it, type in your input file name, in your exampe, file.txt
Test it in Cmd window first, run this "file.exe < InputString.txt"
Do the same in MATLAB using system()

Catégories

En savoir plus sur Software Development Tools dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by