Remove path from file name
Mostrar comentarios más antiguos
Hello!
There's probably a simple tool for this, but I can't find it:
Have a string for a file name that includes the full path, like:
C:\Users\DougAnderson\Documents\MATLAB\SHtest\sig hole 1.xlsx
where the last part (the actual file name) may contain spaces. I would like to change this to, for example
sig hole 1
Thanks
Doug
Respuesta aceptada
Más respuestas (2)
Azzi Abdelmalek
el 11 de Dic. de 2014
s='C:\Users\DougAnderson\Documents\MATLAB\SHtest\sig\hole 1.xlsx'
out=regexp(s,'(?<=\\)[^\\]+$','match')
1 comentario
Douglas Anderson
el 11 de Dic. de 2014
Douglas Anderson
el 11 de Dic. de 2014
0 votos
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!