function [FreqDist,UniqueRows] = HistStr(InputCharArray)
% Histogram (frequency plot) for a character array
% String equivalent of MATLAB function HIST which produces histograms for numeric data
% Syntax (1) HistStr(InputCharArray) - draws the bar graph and returns the frequency of occurrence of rows in InputCharArray
% Syntax (2) [FreqDist,UniqueRows] = HistStr(InputCharArray)
% Draws the bar graph and returns the unique rows in InputCharArray and their frequency

UniqueRows = unique(InputCharArray,'rows');% Get unique rows
FreqDist = [];
for i = 1:size(UniqueRows,1)
    FreqDist = [FreqDist;length(strmatch(UniqueRows(i,:),InputCharArray,'exact'))];
end

bar(1:length(FreqDist),FreqDist)
set(gca,'XTickLabel',UniqueRows)