comparison 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
comparison
equal deleted inserted replaced
330:25b01643e438 331:ba0fee896b41
96 end 96 end
97 97
98 % Should probably use mat2str with some kind of normalization to make all variables valied fieldname 98 % Should probably use mat2str with some kind of normalization to make all variables valied fieldname
99 % and make it possible to recover the value 99 % and make it possible to recover the value
100 function fName = getFieldname(obj, val) 100 function fName = getFieldname(obj, val)
101 if isnumeric(val) 101 if ~ischar(val)
102 valStr = num2str(val); 102 val = toString(val);
103 elseif ischar(val)
104 valStr = val;
105 else
106 error('Dont know what to do with val!');
107 end 103 end
108 fName = sprintf('f%s',valStr); 104
105 fName = matlab.lang.makeValidName(val);
109 end 106 end
110 end 107 end
111 end 108 end