view struct2string.m @ 774:66eb4a2bbb72 feature/grids

Remove default scaling of the system. The scaling doens't seem to help actual solutions. One example that fails in the flexural code. With large timesteps the solutions seems to blow up. One particular example is profilePresentation on the tdb_presentation_figures branch with k = 0.0005
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 18 Jul 2018 15:42:52 -0700
parents 92247f4bad2f
children
line wrap: on
line source

function str = struct2string(s)
    warning('Deprecated! Use toString() instead!');
    fn = fieldnames(s);

    if length(fn) == 0
        str = '{}';
        return
    end

    str = sprintf('{');

    for i = 1:length(fn) - 1
        value = s.(fn{i});
        str = [str sprintf('%s: %s, ',fn{i}, toString(value))];
    end
    value = s.(fn{end});
    str = [str sprintf('%s: %s}',fn{end}, toString(value))];
end

function str  = value2string(value)
    if isnumeric(value) || ischar(value)
        str = mat2str(value);
    elseif isstruct(value)
        str = struct2string(value);
    else
        str = 'NO_STR_REP';
    end
end