function P = read_geo_params(fname)
%READ_GEO_PARAMS Summary of this function goes here
%   Detailed explanation goes here

fid = fopen(fname);
text = textscan(fid, '%s','Delimiter', '\n');

text = text{1};
% Trim whitespaces from beginning and end of lines
text = cellfun(@strtrim, text, 'UniformOutput', false);
% Drop empty lines
num_chars = cellfun(@length, text);
text = text(num_chars > 0);

% Drop lines containing comments
text = text(~strncmp(text, '//', 2));

% Look for parameter definitions
defs = text(cellfun(@(x)~isempty(x), strfind(text, 'DefineNumber')));

defpattern = '^(?<name>\w+)\s*=\s*DefineNumber\[\s*(?<value>\-?[0-9\.]+)';
tokens = regexp(defs, defpattern, 'names');


n = numel(tokens);
% Assemble structure
P = struct([]);
for i = 1 : n
    P(1).(tokens{i}.name) = str2double(tokens{i}.value);
end

end % of read_geo_params function

