view default_field.m @ 1217:a3d9567d9004 feature/d2_compatible

Improve efficiency of construction of D2(b) by precomputing as much as possible
author Martin Almquist <malmquist@stanford.edu>
date Wed, 13 Nov 2019 14:54:22 -0800
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