Looping through command mkdir
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Charles Cummings
am 18 Jan. 2019
Kommentiert: Charles Cummings
am 18 Jan. 2019
For a bit of context, I am trying to create a series of 20000 scenarios given an input parameter of my choosing, and label those newly created files with a file name and the numeral of the paramter I am changing. Below is a portion of the script
function startup
cd ~/Desktop/program/scenario/
%
for X= 100:100:500
mkdir Scenario-NumberX %X is the changing variable which a file name will be made
cd ..
copyfile(['scenario','/*.prm'],'~/Desktop/program/scenario/Scenario-NumberX'
%under 'scenario' should be a number of files of my choosing with parameter files
% each iteration through the loop should be creating a file and placing it in the desired location.
end
Any and all help is appreciated!
2 Kommentare
Star Strider
am 18 Jan. 2019
The mkdir function creates a new directory (folder) not a new file.
Are you sure you want to do that?
Akzeptierte Antwort
Sean de Wolski
am 18 Jan. 2019
for ii = 1:10
mkdir("Scenario" + x)
end
4 Kommentare
Sean de Wolski
am 18 Jan. 2019
This works in newer releases. In older releases
mkdir(['Scenario' num2str(ii)])
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown 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!