[SciPy-user] Stack two matrices on top of each other?

Johann Rohwer jr@sun.ac...
Wed Sep 26 07:40:00 CDT 2007


Use
    numpy.hstack
    numpy.vstack

Johann

Jose Unpingco wrote:
>  
>  a=randn(2,3)
>  bmat([[a],[a]]) # stack them side-by-side
>  
> But, this doesn't work with the semicolon:
>  
>  bmat([[a];[a]]) # not work, although it would be natural
>  
> Is there another way to stack two matrices on top of each other? I know 
> I can do
>  
> bmat('a ; a')
>  
> but I have a list of matrices I would like to stack and doing it this 
> way means that I would have to
> assign a variable to each one of matrices like
>  
> a0=A[0]
> a1=A[1]
> ..
> aN=A[N]
>  
> which is what I'm doing now, but would prefer not to.
>  
>  
> Please contact me if you have questions or need more information.
>  
> Thanks!


More information about the SciPy-user mailing list