4 %> @brief Determines number of columns and delimiter from a CSV file
6 %> Delimiter is determined by maximum probability among a list of the most common CSV delimiters
9 %> @retval [no_cols, deli]
11 % Opens
for the first time to determine the number of columns
12 fid = fopen(filename);
14 irerror(sprintf(
'File not found: %s !', filename));
19 % Tries to figure out which is the delimiter being used
20 delimiters = sprintf(
';,\t');
21 no_delimiters = length(delimiters);
22 no_colss = zeros(1, no_delimiters);
23 for i = 1:no_delimiters
24 no_colss(i) = sum(s == delimiters(i))+1;
27 [no_cols, index] = max(no_colss);
28 deli = delimiters(index);
function get_no_cols_deli(in filename)