Thread Subject: Using .EXE in m-file

Subject: Using .EXE in m-file

From: Luigi Giaccari

Date: 17 Aug, 2009 20:34:18

Message: 1 of 4

I am using a .exe file do to some computation. The problem I have is that launching the.exe file eith the ! command do not stop the m-code script exexution.
SO the the script continues to run without waiting for the .exe to finish.

Is there a way to comunicate in the script the end of the execution of an exe?

Or maybe some C++ command to comunicate the script to wait for the exe?

Thank you very much


http://www.advancedmcode.org/

Subject: Using .EXE in m-file

From: Bruno Luong

Date: 17 Aug, 2009 22:18:03

Message: 2 of 4

"Luigi Giaccari" <giaccariluigi@msn.com> wrote in message <h6cesa$mm6$1@fred.mathworks.com>...
> I am using a .exe file do to some computation. The problem I have is that launching the.exe file eith the ! command do not stop the m-code script exexution.
> SO the the script continues to run without waiting for the .exe to finish.
>

Luigi,

If don't add the "&" sign it should wait until the command finishes. Try this two commands (then type something, then Ctrl C to terminate)

>> !more
>> !more &

If your exe returns right the way then I guess because it launches an independent process on its own.

Bruno

Subject: Using .EXE in m-file

From: Luigi Giaccari

Date: 18 Aug, 2009 06:53:03

Message: 3 of 4

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <h6ckur$ll$1@fred.mathworks.com>...
> "Luigi Giaccari" <giaccariluigi@msn.com> wrote in message <h6cesa$mm6$1@fred.mathworks.com>...
> > I am using a .exe file do to some computation. The problem I have is that launching the.exe file eith the ! command do not stop the m-code script exexution.
> > SO the the script continues to run without waiting for the .exe to finish.
> >
>
> Luigi,
>
> If don't add the "&" sign it should wait until the command finishes. Try this two commands (then type something, then Ctrl C to terminate)
>
> >> !more
> >> !more &
>
> If your exe returns right the way then I guess because it launches an independent process on its own.
>
> Bruno

Thank you Bruno, You are right

I was using

!program.exe&

Removing the & it works, it is easier than I thought.

 Thank you

Subject: Using .EXE in m-file

From: Priyanka Tunuguntla

Date: 19 Jan, 2011 14:31:04

Message: 4 of 4

Hello,

I am facing problem in making matlab wait for an exe file to finish process. I am using
! command to call the exe file. I will need an output file file from this process so that I can use it in the matlab script to carry on further process.

This is the command im using to call the 'fluent' .exe
!'C:\Fluent.Inc\n tbin\win64\fluent.exe -r6 .3.26 3ddp -i "fluent2.jou"'

What should I do for the matlab to wait?

Thanks,
Priyanka


"Luigi Giaccari" <giaccariluigi@msn.com> wrote in message <h6dj4f$3aa$1@fred.mathworks.com>...
> "Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <h6ckur$ll$1@fred.mathworks.com>...
> > "Luigi Giaccari" <giaccariluigi@msn.com> wrote in message <h6cesa$mm6$1@fred.mathworks.com>...
> > > I am using a .exe file do to some computation. The problem I have is that launching the.exe file eith the ! command do not stop the m-code script exexution.
> > > SO the the script continues to run without waiting for the .exe to finish.
> > >
> >
> > Luigi,
> >
> > If don't add the "&" sign it should wait until the command finishes. Try this two commands (then type something, then Ctrl C to terminate)
> >
> > >> !more
> > >> !more &
> >
> > If your exe returns right the way then I guess because it launches an independent process on its own.
> >
> > Bruno
>
> Thank you Bruno, You are right
>
> I was using
>
> !program.exe&
>
> Removing the & it works, it is easier than I thought.
>
> Thank you

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
exe Luigi Giaccari 17 Aug, 2009 16:39:03
standalone Luigi Giaccari 17 Aug, 2009 16:39:03
mex Luigi Giaccari 17 Aug, 2009 16:39:03
binary Luigi Giaccari 17 Aug, 2009 16:39:03
wait for Luigi Giaccari 17 Aug, 2009 16:39:03
rssFeed for this Thread

Contact us at files@mathworks.com