rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
structcpy.m
Go to the documentation of this file.
1 function [s1] = structcpy(s1,s2)
2 % function [s1] = structcpy(s1,s2)
3 % copies the fields of structure s2 into structure s1. If the field to be
4 % copied does not exist in s1 yet, a field with the appropriate name is
5 % created.
6 %
7 
8 % Martin Drohmann, 01.09.2009
9 
10 f2 = fieldnames(s2);
11 for i = 1:length(f2)
12  s1.(f2{i}) = s2.(f2{i});
13 end
14 
function s1 = structcpy(s1, s2)
copies the fields of structure s2 into structure s1. If the field to be copied does not exist in s1 y...
Definition: structcpy.m:17