MATLAB: How to use variables in mkdir foldermkdirvariables Hello; Let's say I have four different variables (a, b, c, d) and I want to create folders using these variables as the name of my folder (folder name= a.b.c.d) How can I do this using mkdir? Thanks, Tina Best Answer Hi,what abouta = 'hello'b = 'world'c = 12d = 'xxx'mkdir([a,'.',b,'.',num2str(c),'.',d]) Related SolutionsMATLAB: Can I use fullfile() to read two subfolders Hello Yanagawa, You should use for loop for that operation to get one by one each folder path.Try this (also detects all folders in a parent folder). You can create a cell array of folder names you wish in folders variable.Main_Folder = 'C:/users';files = dir(Main_Folder);idx = [files.isdir];folders = {files(idx).name}; % this can be your folders = {'Faces','NonFaces'}% If You can also only define folders you don't need above code. subfolder = cell(1,numel(folders));for i = 1:numel(folders) subfolder{i} = fullfile(Main_Folder, folders{i}) cd(subfolder{i}) % Change your directory to i'th subfolder % do what you want (your file extraction, etc) in that current directoryend MATLAB: Matlab Help naming folder according to user input, mkdir(B) Related QuestionHow to make a new folder within another folderFetching variable from another variableHow to make directories within directories within directoriesRead all audio files in one directoryCreate folders using matlabHow to find a sub-folder in the (just in the) current directoryHow to get the output to only show once, if there is only one output to be shown
Best Answer