diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/tools/sappend.m	Tue Feb 10 15:05:51 2015 +0000
@@ -0,0 +1,20 @@
+function target = sappend(target, source)
+% target = sappend(target, source)
+%
+% appends source to target
+% target = [] or struct(), source = struct()
+% 
+% updates the srtuct target by adding the source strut at its end
+% if target = [], it is initialised by the first struct in source
+
+
+if isempty(target)
+    target = source(1);
+    starti = 2;
+else
+    starti = 1;
+end
+
+for i = starti:numel(source)
+    target(end+1) = source(i);
+end
\ No newline at end of file