matlab create directory if it doesn't exist code example Example: if directory exist matlab if ~exist(yourFolder, 'dir') mkdir(yourFolder) end