check if folder exists in matlab code example Example: if directory exist matlab if ~exist(yourFolder, 'dir') mkdir(yourFolder) end