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:
Help with selecting multiple files

Subject: Help with selecting multiple files

From: AsYouWish

Date: 12 Dec, 2012 00:23:16

Message: 1 of 2

So I have searched the message boards but haven't seen what I am looking for. Here is what I am trying to do.

1. Select multiple files from a directory. I currently can select a single file with the following. The number of files to open varies each time I will use this.

DefaultFile='';
[oldFileName,PathName] = uigetfile('*.dat','Select File to Modify',DefaultFile);
fid=fopen(fullfile(PathName,oldFileName));

2. Then I perform some stuff on one of the files.

3. Then I save the new file with a different extension using an fopen(), fprint(), and fclose().

4. Next I would like to perform steps 2 and 3 with each file selected in step 1 until all files have been modified and saved with the new extension.

Any tips?

Thanks.

Subject: Help with selecting multiple files

From: Jos (10584)

Date: 12 Dec, 2012 08:10:12

Message: 2 of 2

"AsYouWish" wrote in message <ka8ipk$p54$1@newscl01ah.mathworks.com>...
> So I have searched the message boards but haven't seen what I am looking for. Here is what I am trying to do.
>
> 1. Select multiple files from a directory. I currently can select a single file with the following. The number of files to open varies each time I will use this.
>
> DefaultFile='';
> [oldFileName,PathName] = uigetfile('*.dat','Select File to Modify',DefaultFile);
> fid=fopen(fullfile(PathName,oldFileName));
>
> 2. Then I perform some stuff on one of the files.
>
> 3. Then I save the new file with a different extension using an fopen(), fprint(), and fclose().
>
> 4. Next I would like to perform steps 2 and 3 with each file selected in step 1 until all files have been modified and saved with the new extension.
>
> Any tips?
>
> Thanks.

Read the help of UIGETFILE thoroughly on how to select multiple files.

Then loop over the returned cell array

~ Jos

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