function y = File2Cell(filename,delimiter)
% Syntax y = File2Cell(filename,delimiter)
% Used to import data from files which contain both numeric and non-numeric data
% Reads and converts an entire file into a cell array based on a delimiter
% Returns a cell array where rows are lines and columns are the delimited data

fclose('all');
fid1 = fopen(filename);
if fid1 == -1
    disp('Operation was unsuccessful - Check the filename')
    y = [];
    return
end
i = 1;

while ~feof(fid1)
    % Read a line
    d = fgets(fid1);
    % Tokenize the line using the delimiter
    a = makemat(d,delimiter);
    for k = 1:size(a,1)
        y{i,k} = a(k,:);
    end
    i = i + 1;
end

fclose(fid1);