sayyad
sayyad

Reputation: 41

Matlab, system and exe

I want to execute exe in matlab. code:

system('program1.exe')

it works , but how can I open two exe at a time.

system('program1.exe')
system('program2.exe')

will not work.

Upvotes: 2

Views: 3615

Answers (2)

Andrew Janke
Andrew Janke

Reputation: 23858

Use the Windows start command to launch a program asynchronously.

system('start program1.exe')
system('start program2.exe')

There is a quirk with the syntax for start. If you quote the paths to the program exe, you must supply a quoted window title in front of it.

system('start "foo" "C:\path\to\program1.exe"')
system('start "bar" "C:\path\to\program2.exe"')

Type help start at the Windows Command Prompt to see doco for it.

You could also call the Java java.lang.Runtime class's exec method. All standard Java SE classes are available inside Matlab.

Upvotes: 2

abcd
abcd

Reputation: 42225

You should either enter them in separate lines like this

system('program1.exe')
system('program2.exe')

or, if you want to keep them on a single line, insert a comma between them like this: system('program1.exe'),system('program2.exe').

Upvotes: 1

Related Questions