annotate core/tools/sappend.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function target = sappend(target, source)
wolffd@0 2 % target = sappend(target, source)
wolffd@0 3 %
wolffd@0 4 % appends source to target
wolffd@0 5 % target = [] or struct(), source = struct()
wolffd@0 6 %
wolffd@0 7 % updates the srtuct target by adding the source strut at its end
wolffd@0 8 % if target = [], it is initialised by the first struct in source
wolffd@0 9
wolffd@0 10
wolffd@0 11 if isempty(target)
wolffd@0 12 target = source(1);
wolffd@0 13 starti = 2;
wolffd@0 14 else
wolffd@0 15 starti = 1;
wolffd@0 16 end
wolffd@0 17
wolffd@0 18 for i = starti:numel(source)
wolffd@0 19 target(end+1) = source(i);
wolffd@0 20 end