The following Matlab project contains the source code and Matlab examples used for pushd, popd, dirs.
pushd, popd, and dirs implement a unix-style directory stack. It uses a global variable to hold the stack.
Example usage:
> cd myDir
myDir> pushd( 'anotherDir' )
anotherDir> %excute commands here
anotherDir> dirs
myDir
anotherDir> popd
myDir> % back to where you started