How to use 'mkdir' command to make folders labelled as 1, 2, 3 till 100 using for loop in matlab code?
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
SYED AQEEL HAIDER
am 15 Feb. 2022
Beantwortet: Akira Agata
am 15 Feb. 2022
I have cretaed a folder in E: drive named as P2. In that foler, I have to make 100 subfolders during execution of code and 50 images are to be stored in each folder. I know that for creating a folder labelled as 1, I have to write 'mkdir P2 1' command and so on till 'mkdir P2 100'. To automate folder creation, I want to use for loop. Please guide. Thanks in anticipation.
0 Kommentare
Akzeptierte Antwort
Akira Agata
am 15 Feb. 2022
How about the following?
rootFolder = 'E:\P2';
for kk = 1:100
subFolder = num2str(kk);
folderPath = fullfile(rootFolder, subFolder);
mkdir(folderPath);
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings 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!