MATLAB: Creating folders outside of the current folder

addpathcreate foldercurrent directlycurrent folderfolderMATLABmkdirpath

Hi!
I would like to use MATLAB to create folders in a specified folder. However, I've only been able to get MATLAB to create folder within the current folder (cd) using the 'mkdir' command. Is it possible for it to create folders outside of the current one if it is told where to create it?
Thank you!

Best Answer

Of course, just define the parentFolder, or use a relative/absolute path:
I also recommend using function syntax:
Putting it all together:
mkdir(ParentFolder,NewSubFolder)
mkdir(fullfile(ParentFolder,NewSubFolder))