function x = r8cb_to_r8vec ( m, n, ml, mu, a )

%*****************************************************************************80
%
%% R8CB_TO_R8VEC copies a R8CB matrix to an R8VEC.
%
%  Discussion:
%
%    In C++ and FORTRAN, this routine is not really needed.  In MATLAB,
%    a data item carries its dimensionality implicitly, and so cannot be
%    regarded sometimes as a vector and sometimes as an array.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    27 July 2016
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, N, the number of rows and columns in the array.
%
%    Input, integer ML, MU, the lower and upper bandwidths.
%
%    Input, real A(ML+MU+1,N), the array to be copied.
%
%    Output, real X((ML+MU+1)*N), the vector.
%
  x = zeros ( ( ml + mu + 1 ) * n, 1 );

  for j = 1 : n

    ilo = max ( mu + 2 - j, 1 );
    ihi = mu + 1 + min ( ml, m - j );
    for i = ilo : ihi
      x(i+(j-1)*(ml+mu+1)) = a(i,j);
    end

  end

  return
end
