function parseFields(strct,fields) % function parseFields(strct,fields) % % assigns all the fields in structure to variables in the calling % workspace. if nargin < 2 % parse all fields by default fields = fieldnames(strct); end for n = 1:length(fields) f = fields{n}; assignin('caller',f,strct.(f)) end