Home > marsbar > @mardo > get_contrast_by_name.m

get_contrast_by_name

PURPOSE ^

get named contrast(s) from design contrast structure

SYNOPSIS ^

function [xc, ic] = get_contrast_by_name(D, cname)

DESCRIPTION ^

 get named contrast(s) from design contrast structure
 FORMAT [xc, ic] = get_contrast_by_name(D, cname)
 
 D      - design object
 cname  - contrast name(s) (string or cell array)
 
 Returns
 xc     - xCon structure containing only named contrast
 ic     - index of contrast in design contrast structure

 e.g. [con ic] = get_named_contrasts(D, 'effects of interest');

 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [xc, ic] = get_contrast_by_name(D, cname)
0002 % get named contrast(s) from design contrast structure
0003 % FORMAT [xc, ic] = get_contrast_by_name(D, cname)
0004 %
0005 % D      - design object
0006 % cname  - contrast name(s) (string or cell array)
0007 %
0008 % Returns
0009 % xc     - xCon structure containing only named contrast
0010 % ic     - index of contrast in design contrast structure
0011 %
0012 % e.g. [con ic] = get_named_contrasts(D, 'effects of interest');
0013 %
0014 % $Id$
0015 
0016 if nargin < 2
0017   error('Need contrast name(s)');
0018 end
0019 if ischar(cname)
0020   cname = cellstr(cname);
0021 end
0022 
0023 xc = get_contrasts(D); 
0024 if isempty(xc)
0025   ic = [];
0026 else
0027   ic = find(ismember({xc(:).name}, cname));
0028 end
0029 xc = xc(ic);

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