Page 1 of 1

### Constracting two matrices with odd and even rows

Posted: Wed Oct 23, 2013 7:37 am
I have a matrix with 100 rows and 100 column: M(100,100).
I need to construct two matrices one with the odd rows and with the even rows: M_odd(50,50 and M_even(50,50)

I have extracted the raws using the following loop
for !i =1 to 100
rowvector r!i = @rowextract(M,!i)
next

How can I construct the two matrices with a loop in order to avoid to following manual approach?
EVEN rows
rowplace(M_even,r1,1)
rowplace(M_even,r3,2)
etc...

ODD rows
rowplace(M_odd,r2,1)
rowplace(M_odd,r4,2)
etc...

### Re: Constracting two matrices with odd and even rows

Posted: Wed Oct 23, 2013 8:07 am

Code: Select all

`create u 10matrix(100,100) mrnd(m)vector(50) v_oddvector(50) v_evenfor !i=1 to 50   v_odd(!i) = !i*2-1   v_even(!i) = !i*2nextmatrix m_odd = m.@row(v_odd)matrix m_even = m.@row(v_even)`

### Re: Constracting two matrices with odd and even rows

Posted: Wed Oct 23, 2013 8:30 am
I get the following error message

non numeric argment v_odd in "matrix m_odd = m.@row(v_odd)"

### Re: Constracting two matrices with odd and even rows

Posted: Wed Oct 23, 2013 8:37 am
Which version of EViews?

### Re: Constracting two matrices with odd and even rows

Posted: Wed Oct 23, 2013 8:38 am
Eviews 7.2

### Re: Constracting two matrices with odd and even rows

Posted: Wed Oct 23, 2013 8:43 am
You'll need EViews 8.

### Re: Constracting two matrices with odd and even rows

Posted: Wed Oct 23, 2013 9:02 am
do you have another suggestion which runs in Eviews 7.2?

### Re: Constracting two matrices with odd and even rows

Posted: Wed Oct 23, 2013 9:08 am
You'll have to do the rowplace in a loop.