-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpopdir.m
More file actions
38 lines (33 loc) · 687 Bytes
/
popdir.m
File metadata and controls
38 lines (33 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function NEWDIR = popdir(all);
% NEWDIR = popdir
% NEWDIR = popdir 'all'
%
% Pops the top directory off the current stack.
% cds to it.
% ADR 1998
% version L4.1
% status PROMOTED
% allows popdir all now
global DIRSTACK
switch nargin
case 1
if strcmp(all, 'all')
if ~isempty(DIRSTACK)
NEWDIR = DIRSTACK{length(DIRSTACK)};
cd(NEWDIR);
DIRSTACK = {};
end
else
error('Unknown input arguments.');
end
case 0
if isempty(DIRSTACK)
disp('Directory stack empty.');
else
NEWDIR = DIRSTACK{1};
cd(NEWDIR);
DIRSTACK = DIRSTACK(2:length(DIRSTACK));
end
otherwise
error('Unknown input arguments.');
end