I want to make some tree-like folders
I made my code but I don't how I can use string
Below is my code
for i=1:10;
mkdir('C:\Users\kanje\Desktop\', ['s0' num2str(i) '_e01']);
mkdir('[C:\Users\kanje\Desktop\'s0' num2str(i) '_e01\']', convolution); % here is the problem
mkdir('[C:\Users\kanje\Desktop\'s0' num2str(i) '_e01\']', unconvolution);
for ii=1:9;
mkdir('[C:\Users\kanje\Desktop\'s0' num2str(i) '_e01\convolution']', 'a01_s0' num2str(ii) '_e01');
mkdir('[C:\Users\kanje\Desktop\'s0' num2str(i) '_e01\unconvolution']', 'a01_s0' num2str(ii) '_e01');
end;
end;
Maybe I cannot use well about string
Explain:
a01_e01 to a10_e01 is the parent folder
Each a01_e01 ,..., a10_e01 have convolution & un-convolution folder as see
And the convolution & un-convolution folders have the a01_s01_e01 ,..., a01_s10_e01 folders
At last one parent folder should have a10_s01_e01 to a10_s10_e01 (it's not in this picture)
I think it would be better to use fullfile
command to construct the path names and sprintf
to format the strings:
rootPath = fullfile( 'c:', 'Users', 'kanje', 'Desktop' );
for ai=1:10
baseName = fullfile( rootPath, sprintf( 'a%02d_e01', ai ) );
mkdir( baseName );
for sub = {'convolution', 'unconvolution' }
mkdir( fullfile( baseName, sub{1} ) );
for si=1:10
subName = fullfile( baseName, sub{1}, sprintf( 'a%02d_s%02d_e01', ai, si ) );
mkdir( subName );
end
end
end