The ordering is because the numbers are bigger than 2^31-1, which is the
biggest integer for a 32 bit computer. In the compiled version of
spm_list_files, there is a sort based on numeric values (so that the numbers
9, 10, 11 are ordered correctly, rather than as 10, 11, 9). This goes wrong
with numbers that are too big.
I would suggest moving or renaming spm_list_files.* and introducing a new
spm_list_files.m that contains the following...
function varargout = spm_list_files(varargin)
% Replacement routine that lists files and directories
% FORMAT [Files,Dirs] = spm_list_files(Dir,Filter)
% Dir - directory to list
% Filter - e.g. '*.img'
% Files - filenames
% Dirs - directories
%_______________________________________________________________________
fe = dir([varargin{1} filesep varargin{2}]);
fe = de(cat(1,~de.isdir));
de = dir([varargin{1}]);
de = de(cat(1, de.isdir));
varargout{1} = sortrows(strvcat(fe.name));
varargout{2} = sortrows(strvcat(de.name));
Best regards,
-John
On Thursday 19 January 2006 13:15, Joel Dunn wrote:
> We have a new project with a rather odd file naming convention (not mine)
> which is causing problems with the automatic intelligent filtering with
> spm_get (SPM2 ver), and consequently most other functions.
>
> For example the following files are listed in this order
> p1758920041105_56_rspm.img
> p1780420041216_88_rspm.img
> p1793820050117_86_rspm.img
> p1739120041007_36_rspm.img
> p1722420040910_90_rspm.img
> p1731020041020_79_rspm.img
> p1783320050104_87_rspm.img
>
> I can't follow the code to figure out how this intelligent filtering works,
> but I would like to turn it off and only list the files in standard
> alphanumerical order (even if it displays all 91 .img files).
>
> Is this possible? I would like to do as little hacking as possible...
>
> Thanks
>
> Joel
|