% generic get function (for array)

function result = get(h,field)

if nargin==2
    if max(size(h))==1
        eval(['result = h.' field ';']);
    else
        for i=1:size(h,1)
            for j=1:size(h,2)
                eval(['result(i,j) = h(i,j).' field ';']);
            end
        end
    end
        
elseif nargin==1
    result = fields(h);
end
