matlab to eviews

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

cyp74
Posts: 16
Joined: Tue Mar 13, 2012 4:47 pm

matlab to eviews

Postby cyp74 » Wed Mar 14, 2012 9:01 pm

Hi,
I am trying to replicate a matlab code in EViews but having trouble doing the following loop;

for jj=1:nstep;
impz(jj,:)=shock(jj,:)+zlag*betaz(1:length(betaz),:);
zlag=[impz(jj,:) zlag(1,1:(nlags-1)*nvars)];
end;

I've managed to convert lots of stuff but having trouble with this kinda looping and concatenation. Could anyone please help me with this? Thanks

C.

cyp74
Posts: 16
Joined: Tue Mar 13, 2012 4:47 pm

Re: matlab to eviews

Postby cyp74 » Wed Mar 14, 2012 11:46 pm

Can anyone respond please?

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: matlab to eviews

Postby trubador » Fri Mar 16, 2012 12:18 am

Could you please at least tell us the dimensions of matrices/vectors you are dealing with?

cyp74
Posts: 16
Joined: Tue Mar 13, 2012 4:47 pm

Re: matlab to eviews

Postby cyp74 » Fri Mar 16, 2012 12:38 am

Thanks for your reply Trubador,
impz=15*7
shock=15*7
zlag=1*28
betaz=28*7
nlags=4
nvars=7

Hope it helps

C.

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: matlab to eviews

Postby trubador » Sat Mar 17, 2012 7:27 am

This should be doing what you want:

Code: Select all

!nvars = @columns(shock) !nstep = @rows(shock) !nlags = 4 !extract = (!nlags-1)*!nvars rowvector temp1 rowvector temp2 for !jj = 1 to !nstep temp1 = @rowextract(shock,!jj)+zlag*betaz temp2 = @subextract(zlag,1,1,1,!extract) rowplace(impz,temp1,!jj) matplace(zlag,temp1,1,1) matplace(zlag,temp2,1,!nvars+1) next delete temp*

cyp74
Posts: 16
Joined: Tue Mar 13, 2012 4:47 pm

Re: matlab to eviews

Postby cyp74 » Sun Mar 18, 2012 12:23 am

Trubador, that's awesome. Many thanks


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests