Software Techniques Inc. (www.stiwww.com) HistStr.m 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 Syntax (2) [FreqDist,UniqueRows] = HistStr(InputCharArray) Draws the bar graph and returns the unique rows in InputCharArray and their frequency Sample usage Names = makemat('TY AB TY AC TY AB AB AC AC CA CA AC DA DA DA DA AC DF GH GH TY TY TT'); [Frequen,NNames] = HistStr(Names); % The following line of code will then display the frequency of occurrence beside each of the % labels producing the output below and a histogram showing the distribution graphically [num2str(Frequen) repmat(char(9),length(Frequen),1) NNames] 3 AB 5 AC 2 CA 4 DA 1 DF 2 GH 1 TT 5 TY ** The function makemat (used above to create a character array) is not a native MATLAB function but can be downloaded from this site. Users are encouraged to improve upon this function however you must reference Software Techniques Inc. as the original author and have a link in the M-file pointing to our site (www.stiwww.com). Likewise if we receive any major improvements to the M-file from you, the user we will do the same. I.e. your email address or website will also be noted in the comments of the M-file.