Home > rest_20090422 > rest_spm5_files > @read_nifti > structn.m

structn

PURPOSE ^

Convert a NIFTI-1 object into a form of struct

SYNOPSIS ^

function t = structn(obj)

DESCRIPTION ^

 Convert a NIFTI-1 object into a form of struct
 _______________________________________________________________________
 Copyright (C) 2005 Wellcome Department of Imaging Neuroscience

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

structn.m

SOURCE CODE ^

0001 function t = structn(obj)
0002 % Convert a NIFTI-1 object into a form of struct
0003 % _______________________________________________________________________
0004 % Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
0005 
0006 %
0007 % $Id: structn.m 253 2005-10-13 15:31:34Z guillaume $
0008 
0009 
0010 if numel(obj)~=1,
0011     error('Too many elements to convert');
0012 end;
0013 fn = fieldnames(obj);
0014 for i=1:length(fn)
0015     tmp = subsref(obj,struct('type','.','subs',fn{i}));
0016     if ~isempty(tmp)
0017         t.(fn{i}) = tmp;
0018     end;
0019 end;
0020 return;

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