IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
convert_to_str.m
Go to the documentation of this file.
1 %> @ingroup conversion string codegen
2 %> @file
3 %> @brief Makes it into something that can be eval()'ed
4 %
5 %>@param c
6 %>@return \em s
7 function s = convert_to_str(c)
8 if isnumeric(c)
9  s = mat2str(c);
10 elseif isstr(c)
11  s = ['''', c, ''''];
12 elseif iscell(c)
13  s = '{';
14  for i = 1:size(c, 1)
15  if i > 1; s = [s, '; ']; end;
16  for j = 1:size(c, 2)
17  if j > 1; s = [s ', ']; end;
18  s = [s, convert_to_str(c{i, j})];
19  end;
20  end;
21  s = [s '}'];
22 end;
23