function A = getData(h, data)
%GETDATA Extracts data from the time ValueArray storage object
%
%   Author(s): James G. Owen
%   Copyright 1986-2004 The MathWorks, Inc.
%   $Revision: 1.1.6.1 $ $Date: 2004/12/26 21:34:46 $

% Gets data from the ValueArray data property 
if ~isempty(h.Start) && ~isempty(h.End)
	if isfinite(h.Increment)
       A = (h.Start:h.Increment:h.End)';
       % Add one more increment if doing so would get closer to the end
       % time. This is needed to prevent small round off errors in the
       % increment causing the last time instant to 'vanish'
       if (h.End-A(end))>(A(end)+h.Increment-h.End)
           A = [A; A(end)+h.Increment];
       end
	else
       A = data;  
       % If data is suplied sync the start and end times
       % This is useful when time data sources may have changed
       if length(data)>=2
            L = h.Length;
            h.Length = 0; % Enable writes to Start and End properties
            h.Start = data(1);
            h.End = data(end);
            h.Length = L;
       end
	end    
else
    A = [];
end
