Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

could i please get some coding and some guidance?. PART 4-Create a hierarchy of

ID: 3745140 • Letter: C

Question

could i please get some coding and some guidance?.

PART 4-Create a hierarchy of folders and files For this part, you are going to make repeated calls to the function mkdir as well as repeated file creations Your objective is to start smal, creating 3 folders (binders) with 3 fles each, however you will need to automate the process so that you can quickly generate many directories and files. The folders you need to create are simply labelled binderf, binder2, etc, up to your maximum folder size n. Additionally, inside each of the n directories, you must place m files in TXT format labelled textfile1.bf textile2 txt, etc. The data inside each file must be a magic square of the label size (eg textfile7.bf contains a 7x7 magic square), with the numbers delimited by the pipe character '. You can use the function magie) to quickly generate a magic square of any size. A screenshot of the folder hierarchy for n-5 and m-3 is shown below, as well as a textile7 bxf showing the 7x7 magic square values delimited by pipe characters. Now, edit your code to create 25 folders with 100 files in each folder. How long does your program take to run? You can time your program using tie and toc. How long would it take you to manualy create that many fles (2500 files)?! textfile7.tut+ 1 3013914811110119128 2 381471719118127129 3 461618117126135137 45114116125134136145 5 1311512413314214414 6 2112313214114313112 7 2213114014912111120 Name - binder texthileltit binder2 textfile1.tt textfilelt binde extfile1 t binde textfileltit totfile2st textfilel.t

Explanation / Answer

n=25;
m=100;
tic
for i=1:n
dirName=['binder',num2str(i)];
mkdir(dirName);
for j=1:m
fileName=['textfile',num2str(j),'.txt'];
dlmwrite([pwd,'',dirName,'',fileName],magic(j),'delimiter','|','newline','pc')
end
end
toc