MATLAB: Find string ends with xls or xlsx

char arraycompareregexpstring

I have a char array of strings (each string is a file name) and I would like to find out the strings that ends with xls or xlsx. I know that strcmp can be used only if to compare the first few characters, which is the opposite of what I intent to do—compare the last few characters.
What should I do in this case? Thank you.

Best Answer

str='abc.xlsx xls.m df.xls er.doc sd.xls'
out=regexp(str,'\S+\.xlsx?\>','match')