From: Jan Simon on 21 Jul 2010 05:58 Dear Schroen, > I could not find the function GetFullPath (neither in Matlab nor in the system). Jan, do you have a Matlab version you can provide? I could provide a C-Mex file in the FEX. At first I'll compare the speed with the mentioned Java methods mentioned by Us (thanks!). If it is worth, I'll publish GetFullPath. > I analyzed the problem more: The selection of the path (whether with dots or without) depends on the current working directory. So the best idea would be to use working directories without "\..". Opening files in the editor including "\." and "\.." might confuse further functions also. So simply avoid this. Jan
From: Jan Simon on 21 Jul 2010 06:17 Dear us, > consider that these already do the job: > help which; % <- as shown in the example above > % and in recent ML versions > fnam=System.IO.FileInfo(fnam); % <- with a slew of output infos > % plus, there's still good old slow java's file class... For a cell string with 754 M-files with already fully qualified path (so no changes are needed atr all): tic; for k = 1:754; name{k} = which(name{k}); end; toc >> 0.506 sec tic; for k = 1:754; m = System.IO.FileInfo(name{k}); name{k} = m.FullName; end; toc >> 1.527 sec tic; for k = 1:754; name{k} = GetFullPath(name{k}); end; toc >> 0.009 sec (Matlab 2009a, WinXP 32bit, 1.5GHz Pentium-M, MSVC 2008) WHICH finds only existing files, while GetFullPath works with not existing files and all folders also. System.IO.FileInfo checks the existence already, what is a nice feature, but slow, if you do not need it. Therefore I'll put it into the FEX. Kind regards, Jan
From: Jan Simon on 21 Jul 2010 14:50
Dear Schroen, GetFullPath: http://www.mathworks.com/matlabcentral/fileexchange/28249 This cannot solve your problem directly. But you can use it to clean the path of the files you use/open/debug. Good luck, Jan |