Home > marsbar > @marsy > block_rows.m

block_rows

PURPOSE ^

gets/sets cell array of rows for each (subject/session) block

SYNOPSIS ^

function r = block_rows(Y, rows)

DESCRIPTION ^

 gets/sets cell array of rows for each (subject/session) block

 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function r = block_rows(Y, rows)
0002 % gets/sets cell array of rows for each (subject/session) block
0003 %
0004 % $Id$
0005 
0006 ys = y_struct(Y);
0007 n  = n_time_points(Y);
0008 if nargin < 2  % get
0009   if ~isfield(ys, 'block_rows')
0010     r = {[1:n]'};
0011   else
0012     r = ys.block_rows;
0013   end
0014 else           % set
0015   if ~iscell(rows)
0016     error('Need cell array of matrices for blocks');
0017   end
0018   for i = 1:prod(size(rows))
0019     rows{i} = rows{i}(:);
0020     if any(rows{i} < 1 | rows{i} > n)
0021       error(sprintf('Row %d: values out of range', i));
0022     end
0023   end
0024   ys.block_rows = rows;
0025   r = y_struct(Y, ys);
0026 end

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