function dataCells = ...
                 readDelimitedAsCellArray(fname, delimiter)
% Reads an excel-exported CSV file to a big cell array of text, to be
% later interpreted as text, numerical, and timestamp values. The
% delimiter character must not occur in value fields; this provides no
% escape mechanisms. TODO: Polite messages for missing file etc.

if nargin<2
    delimiter = ';';
end

fid = fopen(fname);
iR = 0;

while feof(fid) == 0
    iR = iR + 1;
    S = fgetl(fid);
    dlminds = findstr(S,delimiter);
    dlminds = [0 dlminds length(S)+1];
    if iR==1, lenfirst = length(dlminds); end
    if length(dlminds)  ~= lenfirst
      warning('Row length doesn''t match; Skipping row %d of file %s',...
	      iR, fname);
      continue;
    end
    for iCell = 1:(length(dlminds)-1)
      dataCells{iR,iCell} = S(dlminds(iCell)+1:(dlminds(iCell+1)-1));
    end
end

fclose(fid);
