Home > marsbar > @marsy > split.m

split

PURPOSE ^

method splits regions in object into separate objects

SYNOPSIS ^

function o_arr = split(o)

DESCRIPTION ^

 method splits regions in object into separate objects
 
 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function o_arr = split(o)
0002 % method splits regions in object into separate objects
0003 %
0004 % $Id$
0005   
0006 r = region(o);
0007 st = y_struct(o);
0008 is_s = isfield(st, 'Y') & isfield(st, 'Yvar');
0009 if is_s
0010   Y = st.Y;
0011   Yvar = st.Yvar;
0012 else
0013   % remove any rogue Y or Yvar fields
0014   st = mars_struct('strip', st, {'Y','Yvar'});
0015 end
0016 for i = 1:length(r)
0017   r_st = st;
0018   r_st.regions = r(i);
0019   if is_s
0020     r_st.Y    = Y(:, i);
0021     r_st.Yvar = Yvar(:, i);
0022   end
0023   o_arr(i) = y_struct(o, r_st);
0024 end

Generated on Thu 17-Mar-2016 01:14:46 by m2html © 2005