Home > rest_20090422 > rest_spm5_files > @create_file_array > private > dim.m

dim

PURPOSE ^

Format

SYNOPSIS ^

function varargout = dim(varargin)

DESCRIPTION ^

 Format
 For getting the value
 dat = dim(obj)

 For setting the value
 obj = dim(obj,dat)
 _______________________________________________________________________
 Copyright (C) 2005 Wellcome Department of Imaging Neuroscience

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

DOWNLOAD ^

dim.m

SOURCE CODE ^

0001 function varargout = dim(varargin)
0002 % Format
0003 % For getting the value
0004 % dat = dim(obj)
0005 %
0006 % For setting the value
0007 % obj = dim(obj,dat)
0008 % _______________________________________________________________________
0009 % Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
0010 
0011 %
0012 % $Id: dim.m 253 2005-10-13 15:31:34Z guillaume $
0013 
0014 
0015 if nargin==2,
0016     varargout{1} = asgn(varargin{:});
0017 elseif nargin==1,
0018     varargout{1} = ref(varargin{:});
0019 else
0020     error('Wrong number of arguments.');
0021 end;
0022 return;
0023 
0024 function dat = ref(obj)
0025 dat = obj.dim;
0026 return;
0027 
0028 function obj = asgn(obj,dat)
0029 if isnumeric(dat) && all(dat>=0) && all(rem(dat,1)==0),
0030     dat = [double(dat(:)') 1 1];
0031     lim = max([2 find(dat~=1)]);
0032     dat = dat(1:lim);
0033     obj.dim = dat;
0034 else
0035     error('"dim" must be a vector of positive integers.');
0036 end;
0037 return;

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