rbmatlab 0.10.01
general/basic/structcpy.m
Go to the documentation of this file.
00001 function [s1] = structcpy(s1,s2)
00002 % function [s1] = structcpy(s1,s2)
00003 % copies the fields of structure s2 into structure s1. If the field to be
00004 % copied does not exist in s1 yet, a field with the appropriate name is
00005 % created.
00006 %
00007 
00008 % Martin Drohmann, 01.09.2009
00009 
00010 f2 = fieldnames(s2);
00011 for i = 1:length(f2)
00012   s1.(f2{i}) = s2.(f2{i});
00013 end
00014 
 All Classes Namespaces Files Functions Variables