IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
params2str.m
Go to the documentation of this file.
1 %>@ingroup conversion string
2 %>@file
3 %>@brief Converts a parameters cell into a string
4 %>
5 %> The parameters cell is like {'name1', value1, 'name2', value2, ...}
6 %> @todo find and group documentation about this parameters convention
7 %
8 %> @param params
9 %> @param flag_o =0. Whether to generate a string like "o.property1 = value1;\no.property2 = value2;\n ..."
10 %> @return A string
11 function s = params2str(params, flag_o)
12 
13 if nargin < 2 || isempty(flag_o) || ~flag_o
14  s = '{';
15  for i = 1:length(params)/2
16  if i > 1; s = [s ', ...' char(10)]; end;
17  s = [s '''' params{i*2-1} ''', ' params{i*2}];
18  end;
19  s = [s '}'];
20 else
21  s = '';
22  for i = 1:length(params)/2
23 % if i > 1; s = [s ', ...' char(10)]; end;
24  s = cat(2, s, 'u.', params{i*2-1}, ' = ', params{i*2}, ';', 10);
25  end;
26 end;
function params2str(in params, in flag_o)