IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
cell2str.m
Go to the documentation of this file.
1 %> @ingroup conversion string
2 %> @file
3 %> @brief Converts cell to string.
4 %> The generated string will produce the same cell (i.e., c again) if eval()'uated.
5 %>
6 %> Works only if the elements from c are strings. Originally designed to be used by datatool.
7 %
8 %>@param c
9 %>@return \em s
10 function s = cell2str(c)
11 [q, w] = size(c);
12 s = '{';
13 for i = 1:q
14  if i > 1
15  s = [s, '; '];
16  end;
17  for j = 1:w
18  if j > 1; s = [s ', ']; end;
19  if isstr(c{i, j})
20  s = [s '''' c{i, j} ''''];
21  else
22  s = [s mat2str(c{i, j})];
23  end;
24  end;
25 end;
26 s = [s '}'];