view default_field.m @ 1219:505333c37473 feature/d2_compatible

Close branch feature/d2_compatible
author Martin Almquist <malmquist@stanford.edu>
date Wed, 13 Nov 2019 23:36:19 +0000
parents d1c13505182a
children
line wrap: on
line source

function default_field(s, f, val)
    if isfield(s,f) && ~isempty(s.(f))
        return
    end
    s.(f) = val;
    assignin('caller', inputname(1),s);
end