function cont=dirRetrieval(dname, sp) % Returns the contents of the directory with % name dname if sp == 0 cont = dir(dname); cont = cont(3:end); elseif sp == 1 cont = dir(dname); if isempty(cont) error([dname ': didn''t found anything']); end end