Mercurial > repos > public > sbplib
diff Dictionary.m @ 331:ba0fee896b41 feature/beams
Made dictionary more general.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 29 Sep 2016 13:04:16 +0200 |
parents | 8298734b1938 |
children |
line wrap: on
line diff
--- a/Dictionary.m Thu Sep 29 12:56:37 2016 +0200 +++ b/Dictionary.m Thu Sep 29 13:04:16 2016 +0200 @@ -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