create new folders by mkdir()
31 次查看(过去 30 天)
显示 更早的评论
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 ..
0 个评论
采纳的回答
the cyclist
2016-12-15
编辑:the cyclist
2016-12-15
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 个评论
the cyclist
2016-12-15
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.
更多回答(1 个)
kousar majeed
2019-6-12
i just want to create folder and name it faces
4 个评论
the cyclist
2019-6-16
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
2019-6-16
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
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!