Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st:weave two matrices row by row


From   Amanda Fu <[email protected]>
To   [email protected]
Subject   st:weave two matrices row by row
Date   Sun, 26 Dec 2010 19:34:28 -0500

Hi All,

I was wondered if there is any way to weave two matrix row by row.
Say, I have matrix A [10,8] and B[10,8]. I want to create a new matrix
C looks like as:

matrix C [20,8]:
---------------------------------
row 1 :        row 1 of A
row 2:         row 1 of B
row 3:         row 2 of A
row 4:         row 2 of B
..........
row 19:      row 10 of A
row 20:      row 10 of B
---------------------------------
Right now I think I could do the following:

(1) matrix define C as a 20*8 matrix.
(2) use -mkmat- to change A and B into 8 variables respectively
A1,A2,..A8,B1,..,B8.
(3) Then define each row using the variables from (2).

But  when actually conducting the above way,I find it requires to be
very careful and  much more work than I expected. This is why I think
it would be better that I ask the expert here to see how an expert
will deal with this.

Thanks for your time!

Sincerely,
Amanda
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index