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