function hInfo=parsehistory(c,hString,numRevisions)
%PARSEHISTORY parses model history string into cell array

%   Copyright (c) 1997-2000 by The MathWorks, Inc.
%   $Revision: 1.3 $  $Date: 2000/03/23 19:36:34 $

hInfo=cell(0,4);
currEntry=0;

dashStr=' -- ';
dashLen=length(dashStr);

verStr='Version ';
verLen=length(verStr);


while ~isempty(hString) & currEntry<numRevisions
   [currChunk,hString]=strtok(hString,sprintf('\n'));
      
   dashLoc=findstr(currChunk,dashStr);
   numDashes=length(dashLoc);
   if numDashes>0 & numDashes<=2 & LocIsNumber(currChunk(end))
      %If the current chunk contains a ' -- ' and the
      %last character is a number, we can be pretty sure
      %that it's a header row.
      currEntry=currEntry+1;
      
      authorString=currChunk(1:dashLoc);
      
      if numDashes==2
         dateString=currChunk(dashLoc(1)+dashLen:dashLoc(2)-1);
         verString=currChunk(dashLoc(2)+dashLen+verLen:end);
      else
         dateString=currChunk(dashLoc(1)+dashLen:end);
         verString='';
      end
      
      %dateString=datestr(dateString,c.att.DateFormat);
      
      
      hInfo(currEntry,:)={verString,authorString,dateString,''};
      
   elseif currEntry>0
      hInfo{currEntry,4}=[hInfo{currEntry,4} ' ' currChunk];
   end
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function tf=LocIsNumber(checkChar)

checkChar=abs(checkChar);

tf=(checkChar>=abs('0') & checkChar<=abs('9'));