I have 100 scalars and I want to put them into a column vector.
How can I do it with a loop?
Thank you.
Fill a matrix with scalars
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Fill a matrix with scalars
Code: Select all
for !i=1 to 100
v(!i) = s!i
next
-
olsisthebest
- Posts: 18
- Joined: Wed Jan 13, 2016 4:45 am
Re: Fill a matrix with scalars
Thank you, but the scalars dont have an ordinal name.
Their name do not reflect any order. Is there any alternative?
Their name do not reflect any order. Is there any alternative?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Fill a matrix with scalars
Are there only those 100 scalars in the workfile, or are there other scalars too?
-
olsisthebest
- Posts: 18
- Joined: Wed Jan 13, 2016 4:45 am
Re: Fill a matrix with scalars
There are 300 scalars.
I want to fill 3 matrices with 3 different loops.
Why do you ask? If there was only 100 scalares the procedure will be different?
Thank you, Gareth.
I want to fill 3 matrices with 3 different loops.
Why do you ask? If there was only 100 scalares the procedure will be different?
Thank you, Gareth.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Fill a matrix with scalars
Well if there is no naming pattern, how do you imagine EViews will know which ones to put where? The only way to do it is to manually assign if there is no logical pattern. Note you can use vector.fill to speed things up a little.
-
olsisthebest
- Posts: 18
- Joined: Wed Jan 13, 2016 4:45 am
Re: Fill a matrix with scalars
I was thinking in put the scalars name into a string and then loop over the string.
It is possible?
It is possible?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Fill a matrix with scalars
Sure, but easier just to use fill.
-
olsisthebest
- Posts: 18
- Joined: Wed Jan 13, 2016 4:45 am
Re: Fill a matrix with scalars
Thank you.
It is possible to use wild cards in vector.fill argument? The scalars begin with the same letters.
It is possible to use wild cards in vector.fill argument? The scalars begin with the same letters.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Who is online
Users browsing this forum: No registered users and 2 guests
