Azzera filtri
Azzera filtri

create new folders by mkdir()

21 visualizzazioni (ultimi 30 giorni)
osama
osama il 15 Dic 2016
Commentato: kousar majeed il 16 Giu 2019
i want to create new folders by mkdir() and giving(naming) it numbers sequentially folder1, folder2 .. where no repetead and how to check if folder name found skip and give next number as name for new folder .. please help ,, this part of my project and i havnt time ..

Risposta accettata

the cyclist
the cyclist il 15 Dic 2016
Modificato: the cyclist il 15 Dic 2016
MAX_FOLDER_NUMBER = 10;
FOLDER_ROOT_NAME = 'folder';
for n = 1:MAX_FOLDER_NUMBER
folder_name = [FOLDER_ROOT_NAME,sprintf('%d',n)];
if not(exist(folder_name,'dir'))
mkdir(folder_name)
end
end
I tried to be very explicit about what each step is about. Also, this code checks whether the folder exists, but I don't actually think that is necessary. I don't think mkdir does anything if you try to create a directory that already exists, so you could just do
MAX_FOLDER_NUMBER = 10;
FOLDER_ROOT_NAME = 'folder';
for n = 1:MAX_FOLDER_NUMBER
mkdir([FOLDER_ROOT_NAME,sprintf('%d',n)])
end
or just
for n = 1:10
mkdir(['folder',sprintf('%d',n)])
end
if you don't want my parameterization.
  3 Commenti
osama
osama il 15 Dic 2016
Another question please , how to put this cycle n=1:10 inside GUI function, cause i need to create folder every time that i start code
the cyclist
the cyclist il 15 Dic 2016
I'm not quite sure what you mean. I suggest you open a new, detailed question related to the GUI, because that is quite different from this topic.

Accedi per commentare.

Più risposte (1)

kousar majeed
kousar majeed il 12 Giu 2019
i just want to create folder and name it faces
  4 Commenti
the cyclist
the cyclist il 16 Giu 2019
Your code works fine for me, from a fresh start of MATLAB R2018b.
Are you certain that your code makes it to that line? For example, do you see the output of the line
disp(progIndication);
?
Are you sure you are looking for the directory Faces in the correct place -- the workspace at the moment this line runs? Also, are you looking for faces instead of Faces (case-sensitive)?
kousar majeed
kousar majeed il 16 Giu 2019
i download a video from internet which is 6 to 7 min and there are 7143 images are there.
i made one folder which is frame and second folder which is faces
now i need to upload or with the help of move command to load image from frame folder with the help of GUI and show the image extract the image and crop is and save it in face folder?
need to do the above task to load image in to GUI nad extract the image

Accedi per commentare.

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!

Translated by