Filter löschen
Filter löschen

select folder by its name?

1 Ansicht (letzte 30 Tage)
ludvikjahn
ludvikjahn am 20 Feb. 2015
Kommentiert: ludvikjahn am 20 Feb. 2015
Good Morning, I'd like to sort folders from a folder, let's say:
I have the folder "A" which contains folders:
1
2
3
4
5...
100
if I use
d = uigetdir('C:\A\number') %where number is the name of the folder,it works.
What about taking 'number' as a variable inside the "uigetdir"? Thanks, jahnludvik

Akzeptierte Antwort

Adam
Adam am 20 Feb. 2015
Bearbeitet: Adam am 20 Feb. 2015
n = 10;
d = uigetdir( [ 'C:' filesep 'A' filesep num2str(n) ] )
should work. There are other ways to compose a filename from parts if you prefer, using the fullfile function, but it is equivalent so it's up to you.
fullfile( 'C:', 'A', num2str(n) );
would be the fullfile alternative.
  5 Kommentare
ludvikjahn
ludvikjahn am 20 Feb. 2015
It opens the folder which is open in my workspace
ludvikjahn
ludvikjahn am 20 Feb. 2015
I found the way, thanks

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu File Name Construction finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by