list of folder path

1 visualizzazione (ultimi 30 giorni)
franco otaola
franco otaola il 13 Gen 2018
hello,
i couldn't find any function to obtain the different folders in the current path. for example if i do:
cwd
ans=c:/folder1/folder2/folder3
i wanted to have something like this {'C','folder1','folder2','folder3'} for the moment what i am doing to recover the 'folder3' the only one that i arrived to recover (i want to use the code with different folders paths with different folders name length so i cant read the path and cut parts with
ans(end-14:end-8)
ans='folder2'
so to recover 'folder3' with any length of folders names i made is this code:
folder=pwd;
[upperPath,~,~]=fileparts(folder);
deepestFolder=folder(length(upperPath)+2:end)
deepestFolder='folder3'
if anyone could help me with this issue i would appreciate.

Risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by