Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
CALLING MULTIPLE EXECUTABLE FILE IN MATLAB

Subject: CALLING MULTIPLE EXECUTABLE FILE IN MATLAB

From: Aloyce

Date: 8 Apr, 2009 23:13:02

Message: 1 of 7

I would like to call multiple executable files from different directories. I have twenty subdirectories and each subdirectory has five executables files. I tried to use “system” but I have to list every subdirectory and file.

Subject: CALLING MULTIPLE EXECUTABLE FILE IN MATLAB

From: ImageAnalyst

Date: 9 Apr, 2009 01:24:36

Message: 2 of 7

On Apr 8, 7:13=A0pm, "Aloyce " <aloyce_kal...@subr.edu> wrote:
> I would like to call multiple executable files from different directories=
. =A0I have twenty subdirectories and each subdirectory has five executable=
s files. I tried to use “system” but I have to list every subdi=
rectory and file.

---------------------------------------------------------------------------=
-------------------------------------
Uh, OK. Is there a problem with doing that? Do you have a question?

Subject: CALLING MULTIPLE EXECUTABLE FILE IN MATLAB

From: Trance

Date: 9 Apr, 2009 03:41:09

Message: 3 of 7

Can you generate the call string with eval('system ...')?

Subject: CALLING MULTIPLE EXECUTABLE FILE IN MATLAB

From: Aloyce

Date: 9 Apr, 2009 04:43:01

Message: 4 of 7

Trance <trancemissionxxi@gmail.com> wrote in message <8045dd3a-74b3-48e2-b09e-f6aaf0b36441@e18g2000yqo.googlegroups.com>...
> Can you generate the call string with eval('system ...')?
Can you expand on that by giving examples.

Subject: CALLING MULTIPLE EXECUTABLE FILE IN MATLAB

From: Trance

Date: 9 Apr, 2009 23:41:33

Message: 5 of 7

I assume you use Windows... you can use ls function (notice that 'ls'
behaves differently on Mac/Unix)

Go to the root directory that has your 20 folders.

rootContents=ls;
for dirIdx=1:size(rootContents,1)
   if exist(rootContents(dirIdx,:),'dir')==7 && ~strcmp(rootContents
(dirIdx,:),'.') && ~strcmp(rootContents(dirIdx,:),'..')
        cd(rootContents(dirIdx,:));
        currentExecs=ls('*.exe');
        for exeIdx=1:size(currentExecs,1)
            system([currentExecs(exeIdx,:) ' exe_parameters']);
        end
        cd('..');
   end
end

Subject: CALLING MULTIPLE EXECUTABLE FILE IN MATLAB

From: Aloyce

Date: 23 May, 2009 05:49:01

Message: 6 of 7

Trance <trancemissionxxi@gmail.com> wrote in message <58c65cb6-825e-4fba-82e3-b5bcec77dd44@37g2000yqp.googlegroups.com>...
> I assume you use Windows... you can use ls function (notice that 'ls'
> behaves differently on Mac/Unix)
>
> Go to the root directory that has your 20 folders.
>
> rootContents=ls;
> for dirIdx=1:size(rootContents,1)
> if exist(rootContents(dirIdx,:),'dir')==7 && ~strcmp(rootContents
> (dirIdx,:),'.') && ~strcmp(rootContents(dirIdx,:),'..')
> cd(rootContents(dirIdx,:));
> currentExecs=ls('*.exe');
> for exeIdx=1:size(currentExecs,1)
> system([currentExecs(exeIdx,:) ' exe_parameters']);
> end
> cd('..');
> end
> end
>
>

Subject: CALLING MULTIPLE EXECUTABLE FILE IN MATLAB

From: Aloyce

Date: 23 May, 2009 05:53:01

Message: 7 of 7

 wrote in message <58c65cb6-825e-4fba-82e3-b5bcec77dd44@37g2000yqp.googlegroups.com>...
> I assume you use Windows... you can use ls function (notice that 'ls'
> behaves differently on Mac/Unix)
>
> Go to the root directory that has your 20 folders.
>
> rootContents=ls;
> for dirIdx=1:size(rootContents,1)
> if exist(rootContents(dirIdx,:),'dir')==7 && ~strcmp(rootContents
> (dirIdx,:),'.') && ~strcmp(rootContents(dirIdx,:),'..')
> cd(rootContents(dirIdx,:));
> currentExecs=ls('*.exe');
> for exeIdx=1:size(currentExecs,1)
> system([currentExecs(exeIdx,:) ' exe_parameters']);
> end
> cd('..');
> end
> end
>
>

This worked out. Is there a way to direct all unziped file to a specified directory? Whenever a file is unziped I have to direct matlab where to save it.

Tags for this Thread

No tags are associated with this thread.

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.

Contact us