diff --git a/startMaster.m b/startMaster.m index 287dfa5..968b5f4 100644 --- a/startMaster.m +++ b/startMaster.m @@ -200,8 +200,20 @@ function d = getSplit(d, id) if(isstruct(d)) - d.x = d.x(id, :); - d.y = d.y(id, :); + fields = fieldnames(d); + if(numel(fields)==2) + d.x = d.x(id, :); + d.y = d.y(id, :); + else + for fd = 1:length(fields) + if(ndims(d.(fields{fd}))==3) + d.(fields{fd}) = d.(fields{fd})(:,:, id); + else if(ismatrix(d.(fields{fd})) && length(d.(fields{fd}))>sum(id)) + d.(fields{fd}) = d.(fields{fd})(id); + end + end + end + end else d{1} = d{1}(id, :); d{2} = d{2}(id, :); diff --git a/startSlave.m b/startSlave.m index fc8596c..5748bc8 100644 --- a/startSlave.m +++ b/startSlave.m @@ -120,8 +120,20 @@ function d = getSplit(d, id) if(isstruct(d)) - d.x = d.x(id, :); - d.y = d.y(id, :); + fields = fieldnames(d); + if(numel(fields)==2) + d.x = d.x(id, :); + d.y = d.y(id, :); + else + for fd = 1:length(fields) + if(ndims(d.(fields{fd}))==3) + d.(fields{fd}) = d.(fields{fd})(:,:, id); + else if(ismatrix(d.(fields{fd})) && length(d.(fields{fd})) > sum(id) ) + d.(fields{fd}) = d.(fields{fd})(id); + end + end + end + end else d{1} = d{1}(id, :); d{2} = d{2}(id, :);