1 %>@ingroup conversion
string
3 %> @brief Creates CSV
string to be saved into CSV file
6 %> @param results_table Cell of strings or numbers
7 %> @param deli =TAB. Delimiter
8 %> @
return CSV-formatted
string
9 function s =
cell2csv(results_table, deli)
10 if nargin < 2 || isempty(deli)
15 lce = length(chars_elim);
17 % Converts all elements to str
18 [rows, cols] = size(results_table);
22 t = results_table{i, j};
24 % Eliminates undesired characters
31 stemp(logical(stemp == chars_elim(k))) = [];
34 results_table{i, j} = stemp;
44 % Calculates total stream size
48 len_total = len_total+length(results_table{i, j});
52 len_total = len_total+(cols-1)*rows+rows; % first add for \t and second one for \n
55 s = char(
' '*ones(1, len_total));
62 ilen = length(results_table{i, j});
68 s(iptr:iptr+ilen-1) = results_table{i, j};
73 s(iptr) = sprintf(
'\n');
79 % fprintf(
'%d rowsnow\n', i);
function cell2csv(in results_table, in deli)