0001 function r = block_rows(Y, rows)
0002
0003
0004
0005
0006 ys = y_struct(Y);
0007 n = n_time_points(Y);
0008 if nargin < 2
0009 if ~isfield(ys, 'block_rows')
0010 r = {[1:n]'};
0011 else
0012 r = ys.block_rows;
0013 end
0014 else
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