Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 small, creating 3 directories (folders) with 3 files, however you will need to automate the process so that you can quickly generate many directories and files. The directories you need to create are simply labelled dir1, dir2, etc, up to your maximum directory size n. Additionally, inside each of the n directories, you must place m files in TXT format labelled file1.txt, file2.txt, etc. The data inside each file must be a magic square of the label size (eg. file7.txt contains a 7x7 magic square), with the numbers delimited by the dash character (-). You can use the function magic() to quickly generate a magic square of any size.image text in transcribed

by using matlab

the code

for i=1:n Name=['dir',num2str(i)]; mkdir(Name); for j=1:m M = magic(7); Name1=['file',num2str(j),'.txt']; dlmwrite([Name,'\',Name1],M,'-'); end end

Current Folder file7.txt + Name 1 30-39-48-1-10-19-28 2 38-47-7-9-18-27-29 3 46-6-8-17-26-35-37 4 5-14-16-25-34-36-45 5 13-15-24-33-42-44-4 6 21-23-32-41-43-3-12 7 22-31-40-49-2-11-20 file 1.txt file2.txt file3.tt file 1.txt file2.txt file3.tct file1.txt file2.txt file3.txt file 1.txt file2.txt file3.txt file1.txt file2.tt file3.txt 5420 2974-12 1753 23-23 1863 -12-319 5344 8-1-420 47-6234 3464123 e086-312 fil 3345122 1234567

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions