view default_struct.m @ 752:0be9b4d6737b feature/utux2D

Merge with feature/interpolation to get new interpolation operators.
author Martin Almquist <malmquist@stanford.edu>
date Tue, 22 May 2018 13:31:09 -0700
parents 46256fffa329
children
line wrap: on
line source

function default_struct(s, val)
    if evalin('caller',sprintf('~exist(''%s'',''var'')',s))
        given = [];
    else
        given = evalin('caller', s);
    end

    final = copyWithDefault(given, val);
    assignin('caller', s, final);
end