Mercurial > repos > public > sbplib
diff Dictionary.m @ 886:8894e9c49e40 feature/timesteppers
Merge with default for latest changes
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 15 Nov 2018 16:36:21 -0800 |
parents | ba0fee896b41 |
children |
line wrap: on
line diff
--- a/Dictionary.m Mon Sep 10 16:19:16 2018 +0200 +++ b/Dictionary.m Thu Nov 15 16:36:21 2018 -0800 @@ -98,14 +98,11 @@ % Should probably use mat2str with some kind of normalization to make all variables valied fieldname % and make it possible to recover the value function fName = getFieldname(obj, val) - if isnumeric(val) - valStr = num2str(val); - elseif ischar(val) - valStr = val; - else - error('Dont know what to do with val!'); + if ~ischar(val) + val = toString(val); end - fName = sprintf('f%s',valStr); + + fName = matlab.lang.makeValidName(val); end end end \ No newline at end of file