% STRUCTSTD - calculate the std of all the fields in a struct

function m = structstd(s)

    thefields = fields(s);
    
    for n=1:length(s)
        for k=1:length(thefields)
            m.(thefields{k})(n) = nanstd(s(n).(thefields{k}));
        end
    end
