Code covered by the BSD License  

Highlights from
dirup

dirup

by

 

Get the relative path string to go up a number of levels in the directory structure.

dirup(N_levels)
function s_dirup = dirup(N_levels)
% DIRUP  Get the relative path string to go up a number of levels in the
% directory structure, starting from the current working directory.
%
% relative_path = dirup(N_levels) returns a path string that can be used
% with cd() for example to change to the directory that is [N_levels]
% levels above the current directory.
%
% For example:
%
%     dirup(2)
%
% will return '../../' on Unix-based machines and
%             '..\..\' on Windows machines
%
% See also pwd, cd

% Written by: M. Brandt
% Email     : der.matthias.brandt@gmail.com
% Date      : May 7th, 2013

s_dirup = repmat(['..' filesep], 1, N_levels);

end % of function

Contact us