function out=setfieldmy(in,fld,val); ## Works with version 3.2.4. ## ## In octave 3.2.4, you can't simply request out=setfield(in,fld,val) ## when in is a structure array, and when val is therefore a structure array of ## the values that should go in the relevant slots. ## You will get a struc=struc type error. ## So, we handle this case her. out=in; if numel(out)==1; out=setfield(out,fld,val); ## Or, out.(fld)=val; else for ii=1:numel(out); out(ii).(fld)=val(ii); endfor endif endfunction