No License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

Be the first to rate this file! 2 Downloads (last 30 days) File Size: 1.03 KB File ID: #15537 Version: 1.0




09 Jul 2007 (Updated )

Gets the extension of a file.

| Watch this File

File Information

Gets the extension of a filename. The extension is assumed to be the last dot of the filename and all characters following the last dot. If there is no dot, then FileExtension is empty.

This code seems useful when you allow the user to select a file (eg. using uigetfile), and you want to do different things based on the extension of the file the user has chosen. You could do this with the index options of uigetfile, but this gives a way for the user to see all files in a directory, and still determine the type of file that was chosen.


Findfiles inspired this file.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
11 Jul 2007 John McArthur (Author)

Ah sh!t... my bad. I figured that the code was probably simple enough to not really be useful, but I couldn't find anything in the MatLab Help, or on File Exchange, so thought it might be useful for someone. Guess I have to work on the search engine in my head...

Comment only
11 Jul 2007 J Wagberg

Roossien: Don't be too hard on the guy. Haven't we all been there, painstakingly creating a new great function, only to subsequently find a standard function that does the same thing?

Comment only
10 Jul 2007 Jos x@y.z

fileparts, which is a standard matlab function, can do the same job ...

Comment only
10 Jul 2007 B. Roossien

The build in Matlab function 'fileparts' does all the work for you. Why bother putting such a (trivial) function on the File Exchange?

Comment only

Contact us