O_O
O_O

Reputation: 4477

Matlab - Usage of uigetfile() to grab a specific type of file in a default directory

Does anyone know how to get a specific type of file from matlab from a default directory?

For example, I tried:

defaultpath='C:\'; %enter in path of interest
    [name]=uigetfile(defaultpath);

But how do I make it get only files with i.e. .wav extensions?

I tried:

defaultpath='C:\'; %enter in path of interest
[name]=uigetfile(defaultpath,
    {'*.wav', 'All Wave Files (*.wav)';...
     '*.*', 'All Files (*.*)'}, ...   
     'Pick a file');

but it bombs on the comma after defaultpath in the uigetfile function...

I'm sure this is something common, but I'm not sure how to implement it.

Any ideas? Thanks :)

Upvotes: 0

Views: 1894

Answers (1)

Smash
Smash

Reputation: 3802

Proper usage would be:

[FileName,PathName] = uigetfile('C:\*.wav','All Wave Files (*.wav)');

Upvotes: 2

Related Questions