How to let Matlab execute bat file at the bat file directory.

10 Ansichten (letzte 30 Tage)
Jacky
Jacky am 25 Apr. 2014
Kommentiert: Jacky am 25 Apr. 2014
Hi,
I have two bat files I want to run simultaneously through a matlab script,which also generate some output files.
I use command line as below:
dos('C:\sim\folder1\run.bat &')
dos('C:\sim\folder2\run.bat &')
However, when I run the matlab script using the code above, both the bat files are run in 'C:\sim' because my matlab script is saved in 'C:\sim'. How do I execute the bat files in different directory with my matlab script?
  1 Kommentar
Jacky
Jacky am 25 Apr. 2014
I have found a solution. Create a function with
dos('C:\sim\folder1\run.bat &')
as code in at same folder with the bat file ans use command run in the main matlab script.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by