Mercurial > repos > public > sbplib
view struct2string.m @ 87:0a29a60e0b21
In Curve: Rearranged for speed. arc_length_fun is now a property of Curve. If it is not supplied, it is computed via the derivative and spline fitting. Switching to the arc length parameterization is much faster now. The new stuff can be tested with testArcLength.m (which should be deleted after that).
author | Martin Almquist <martin.almquist@it.uu.se> |
---|---|
date | Sun, 29 Nov 2015 22:23:09 +0100 |
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