Azzera filtri
Azzera filtri

How to get only foldername with uigetdir

94 visualizzazioni (ultimi 30 giorni)
Hello, I want to select a folder (would be subfolder2 in my example) and use its name as a string. The problem is that not only the foldername but the whole location is the output of uigetdir().
name = uigetdir('./subfolder1/');
Is there a simple function to just get the name of the selected folder?
Cheers, J
  1 Commento
Guillaume
Guillaume il 27 Giu 2017
But what if the user navigate to a completely different folder? Maybe not even on the same drive?

Accedi per commentare.

Risposta accettata

Stephen23
Stephen23 il 27 Giu 2017
Modificato: Stephen23 il 23 Mar 2022
fp = uigetdir('./subfolder1/');
[~,name] = fileparts(fp)

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps 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