213 views (last 30 days)
For example, I have filename called abcdefhijklm.xlsx and this file is displayed on the GUI. I wanted to remove the extension in the file name 'xlsx' and display only 'abcdefhijklm'. How can i manipulate this string.
Thanks in Advance Yaseen.
Andreas Goser on 25 Jan 2011
I see two approaches. As you have a filename, you can have MATLAB take care of this by using the FILEPARTS command:
[pathstr, name, ext] = fileparts('abcdefhijklm.xlsx')
There is a generic approach for string search and string manipulation using commands like REGEXP, STRFIND and many others. Here, you would need to define the search logic yourself like "find all dots in the character array, identify the last dot and return all characters before that dot".