Home > rest_20090422 > rest_spm5_files > @create_file_array > size.m

size

PURPOSE ^

overloaded size function for file_array objects.

SYNOPSIS ^

function d = size(a,varargin)

DESCRIPTION ^

 overloaded size function for file_array objects.
 _______________________________________________________________________
 Copyright (C) 2005 Wellcome Department of Imaging Neuroscience

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

size.m

SOURCE CODE ^

0001 function d = size(a,varargin)
0002 % overloaded size function for file_array objects.
0003 % _______________________________________________________________________
0004 % Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
0005 
0006 %
0007 % $Id: size.m 253 2005-10-13 15:31:34Z guillaume $
0008 
0009 
0010 sa  = struct(a);
0011 dim = ones(length(sa),32);
0012 pos = ones(length(sa),32);
0013 
0014 for i=1:length(sa)
0015     sz = sa(i).dim;
0016     dim(i,1:length(sz)) = sz;
0017     ps = sa(i).pos;
0018     pos(i,1:length(ps)) = ps;
0019 end
0020 
0021 tmp = pos==1;
0022 for i=1:32
0023     ind  = find(all(tmp(:,[1:(i-1) (i+1):32]),2));
0024     d(i) = sum(dim(ind,i));
0025 end;
0026 lim = max(max(find(d~=1)),2);
0027 d   = d(1:lim);
0028 
0029 if nargin>1,
0030     if varargin{1}<=length(d),
0031         d = d(varargin{1});
0032     else
0033         d = 1;
0034     end;
0035 end;

Generated on Wed 29-Apr-2009 01:06:38 by m2html © 2005