view general/cpfields.m @ 22:4f5015db91aa

Moved maxnormalise to unitmax
author samer
date Thu, 17 Jan 2013 14:23:21 +0000
parents 03694e5c8365
children b1280319413e
line wrap: on
line source
% cpfields - Copy selected fields from one structure to another
%
% cpfields :: 
%    C:{[N]->string}   ~'fields names to copy', 
%    struct A          ~'struct with field names in A', 
%    struct B          ~'struct with field names in B'
% -> struct union(B,C) ~'struct with fields B union C' :-
%  	subset(C,A)      ~'target fields must be in A'.
function B=cpfields(fields,A,B)
keyboard
	B=foldl(@(b,fn)setfield(b,fn,getfield(A,fn)),B,fields);