simplify weird path name
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Wesley Ooms
le 7 Mai 2014
Modifié(e) : Stephen23
le 31 Août 2015
if i have a valid pathname like this:
C:\folder\\\\subfolder\.\.\..\..\documents\map\dir\\\..\location\
how can i change that to its simplest form in a simple way?
one way i came up with is
stupidpath='C:\folder\\\\subfolder\.\.\..\..\documents\map\dir\\\..\location\'
currentpath=cd
cd stupidpath
cleverpath = cd
cd currentpath
and another way would be with strrep, strfind, etc. but that is both quite cumbersome. is there another, easy way?
0 commentaires
Réponse acceptée
Wesley Ooms
le 7 Mai 2014
2 commentaires
Slim
le 31 Août 2015
This solution yields 'C:\folder\subfolder\documents\map\dir\location', so it doesn't take into account the relative paths.
I would have expect a result more like 'C:\documents\map\location'
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Filename Construction dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!