Mercurial > hg > ltpda
view m-toolbox/classes/+utils/@prog/structcat.m @ 11:9174aadb93a5 database-connection-manager
Add LTPDA Repository utility functions into utils.repository
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
function out = structcat(varargin) % STRUCTCAT concatonate structures to make one large structure. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: STRUCTCAT concatonate structures to make one large % structure. % % CALL: out = structcat(struct1, struct2, ...) % % INPUTS: struct1 - a structure % struct2 - a structure % % OUTPUTS: out - structure with all fields of input structures. % % VERSION: $Id: structcat.m,v 1.1 2008/06/18 13:35:11 hewitson Exp $ % % HISTORY: 26-01-2007 M Hewitson % Creation % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% out = []; for s=1:nargin % get first input structure st = varargin{s}; % check fields fields = fieldnames(st); nf = length(fields); for f=1:nf field = fields{f}; % check if this field already exists if isfield(out, field) warning(sprintf('!!! duplicate field ''%s'' found - skipping.', field)); else % we can add this field out.(field) = st.(field); end end end % END