[Limdep Nlogit List] Formatting a matrix

Steven Yen syen at utk.edu
Thu Jan 21 09:15:36 EST 2010


Dear fellow LIMDEPers:
I know how to reformat a 6 x 1 vector into a 2 x 3 matrix using 
matrix function "mvec" (see below). However, how do I format a 8 x 1 
vector into 2 complete rows of 3 plus an incomplete row with 2 
elements, as shown below:

        1|   -7.86432      2.49549      2.26915
        2|    2.71446       .01615       .30027
        3|   -2.51978       .04063

---

--> matrix ;list ;c=part(all,1,6) ;c=mvec(c,2,3) $

Matrix C        has  6 rows and  1 columns.
                1
         +--------------
        1|   -7.86432
        2|    2.49549
        3|    2.26915
        4|    2.71446
        5|     .01615
        6|     .30027

Matrix C        has  2 rows and  3 columns.
                1             2             3
         +------------------------------------------
        1|   -7.86432      2.49549      2.26915
        2|    2.71446       .01615       .30027

--> matrix ;list ;c=part(all,1,8) ;c=mvec(c,3,3) $

Matrix C        has  8 rows and  1 columns.
                1
         +--------------
        1|   -7.86432
        2|    2.49549
        3|    2.26915
        4|    2.71446
        5|     .01615
        6|     .30027
        7|   -2.51978
        8|     .04063
   Error   295: MATRIX MVEC(name,r,c). Too few elements to make rxc matrix.



Steven T. Yen
http://web.utk.edu/~syen/
Check out our postdoc opening at:
http://web.utk.edu/~syen/postdoc.html


More information about the Limdep mailing list