function r = mymkdir(dir)
% r = mymkdir(dir)
% Ensure that dir exists by creating all its parents as needed.
% 2006-08-06 dpwe@ee.columbia.edu
[x,m,i] = fileattrib(dir);
if x == 0
[pdir,nn] = fileparts(dir);
disp(['creating ',dir,' ... ']);
mymkdir(pdir);
% trailing slash results in empty nn
if length(nn) > 0
mkdir(pdir, nn);
end
end