Home > marsbar > @mardo > get_vol_field.m

get_vol_field

PURPOSE ^

method to get named field, containing or referring to vol structs

SYNOPSIS ^

function V = get_vol_field(D, fieldn)

DESCRIPTION ^

 method to get named field, containing or referring to vol structs
 FORMAT V = get_vol_field(D, fieldn)
 
 D        - design object
 fieldn   - field name
 
 Returns
 V        - vol struct

 e.g Vbeta = get_vol_field(D, 'Vbeta');
 
 We need to deal with the fact that vol fields can be char or vol_structs.
 SPM99, for good reason, stored the design structs from the results of the
 estimation as file names, which then had to be remapped with spm_vol to
 get the vol structs.  The good reason was that this avoided
 byte-swapping problems if the design was copied to another system.
 
 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function V = get_vol_field(D, fieldn)
0002 % method to get named field, containing or referring to vol structs
0003 % FORMAT V = get_vol_field(D, fieldn)
0004 %
0005 % D        - design object
0006 % fieldn   - field name
0007 %
0008 % Returns
0009 % V        - vol struct
0010 %
0011 % e.g Vbeta = get_vol_field(D, 'Vbeta');
0012 %
0013 % We need to deal with the fact that vol fields can be char or vol_structs.
0014 % SPM99, for good reason, stored the design structs from the results of the
0015 % estimation as file names, which then had to be remapped with spm_vol to
0016 % get the vol structs.  The good reason was that this avoided
0017 % byte-swapping problems if the design was copied to another system.
0018 %
0019 % $Id$
0020 
0021 if nargin < 2
0022   error('Need field name');
0023 end
0024 
0025 SPM = des_struct(D);
0026 if ~isfield(SPM, fieldn)
0027   error([ fieldn ' is not a field in design']);
0028 end
0029 V = getfield(SPM, fieldn);
0030 V = full_vol(D, V);

Generated on Wed 11-May-2022 16:26:09 by m2html © 2003-2019