Is there any way to get extension of a file from its filename ?? The only algo I could develop to do the above task is to find last '.' and rest all str开发者_运维百科ing to end..
But not too sure how to get index of final '.' from the given string..
Any new idea or suggestion for the same ??
I'm actually trying to develop a filter which only does processing on all image files rather than other non image file... Is there any other way of doing the same using any inbuilt function ???
Use the built in function "fileparts".
You can use the regexp
function with the split
parameter
output = regexp(your_string, '\.', 'split')
The output is a cell array that you can pull the value you want out of.
http://www.mathworks.com/help/techdoc/ref/regexp.html
精彩评论