0001 function pathname = getpath_jd(filename); 0002 % 0003 fullpath = which([filename]); 0004 % 0005 ns = length(fullpath); 0006 while ns > 0 & fullpath(ns) ~= '\' & fullpath(ns) ~= '/' 0007 ns = ns - 1; 0008 end 0009 0010 pathname = fullpath(1:ns-1);