## Constracting two matrices with odd and even rows

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

RDS
Posts: 86
Joined: Thu Feb 17, 2011 9:50 am

### Constracting two matrices with odd and even rows

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...

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12543
Joined: Tue Sep 16, 2008 5:38 pm

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

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)`

RDS
Posts: 86
Joined: Thu Feb 17, 2011 9:50 am

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

I get the following error message

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12543
Joined: Tue Sep 16, 2008 5:38 pm

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

Which version of EViews?

RDS
Posts: 86
Joined: Thu Feb 17, 2011 9:50 am

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

Eviews 7.2

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12543
Joined: Tue Sep 16, 2008 5:38 pm

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

You'll need EViews 8.

RDS
Posts: 86
Joined: Thu Feb 17, 2011 9:50 am

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

do you have another suggestion which runs in Eviews 7.2?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12543
Joined: Tue Sep 16, 2008 5:38 pm

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

You'll have to do the rowplace in a loop.

### Who is online

Users browsing this forum: No registered users and 2 guests