A question: Eviews-Matlab interface?

9 vues (au cours des 30 derniers jours)
Sabbas
Sabbas le 4 Août 2012
Modifié(e) : Sugato le 19 Jan 2017
I would like to ask if there is any way to manipulate Eviews via MATLAB
thanks
  1 commentaire
Sabbas
Sabbas le 5 Août 2012
probably no.

Connectez-vous pour commenter.

Réponse acceptée

Oleg Komarov
Oleg Komarov le 5 Août 2012
So virtually you can control EViews with COM Automation objects.
I don't have EViews to test it.

Plus de réponses (1)

Sugato
Sugato le 19 Jan 2017
Modifié(e) : Sugato le 19 Jan 2017
I will provide a few more updates: A consolidation of what I have been able to search up at various sites.
...
This is covered in a document on the EViews web site: Eviews COM Automation. From MATLAB, create a handle to an ActiveX control and use that to pass the data back and forth in memory.
% launch EViews ActiveX server
hm = actxserver('Eviews.Manager') ;
h = hm.GetApplication(0) ;
% load file
h.Run(sprintf('wfuse %s',myPath)) ;
% dates
h.Run(sprintf('string startDate = %s.@first',myVar)) ;
startDate = h.Get('startDate') ;
h.Run(sprintf('string endDate = %s.@last',myVar)) ;
endDate = h.Get('endDate') ;
% drop consecutive leading/trailing missing observations
h.Run(sprintf('smpl %s %s',startDate,endDate)) ;
% transfer values
values = cell2mat(h.GetSeries(myVar)) ;
h.release ;
Note that there is some start-up time because one must wait for Eviews to launch in the background before it can be used, so if you want to import multiple series it would be advisable to insert the loop after the creation of the handle to the ActiveX control.
Also note that this does not work with all versions of Eviews. If you have difficulty, first contact the manufacturer to obtain a patch.
...
The following is from the Eviews official site, explaining how to communicate with MATLAB from within EVIEWS.
The follow program offers a simple example using MATLAB to perform a least-squares regression (more complicated operations may be performed by using xrun to run a MATLAB program):
'create a workfile
wfcreate u 100
'create some data
series y=nrnd
series x1=nrnd
series x2=nrnd
'group regressor data into a group
group xs c x1 x2
'open a connection to Matlab with lower-case default output names
xopen(type=m, case=lower)
'put regressors and dependent variable into Matlab
xput xs
xput y
'run a command to perform least squares as a matrix operation
xrun "beta = inv(xs'*xs)*xs'*y"
'retrieve betas back into EViews
xget beta
'perform same least squares estimation in EViews
equation e1.ls y xs
show e1
show beta
'close Matlab connection
xclose
The program first creates a new workfile, and then creates some series objects. The series called Y is the dependent variable, and the series X1 and X2 are the regressors (along with a constant). xopen is used to open a connection to MATLAB, and then xput is used to pass the dependent variable and the regressors over to MATLAB. Note that the names of the matrices and vectors will all be lower-cased in MATLAB since the connection was opened with the “case=lower” option. xrun is used to create a vector in MATLAB, called “beta”, equal to the least squares coefficient, using the matrix algebra formula for LSQ. beta is brought back into EViews with the xget command, and then we estimate the same equation inside EViews and show the two results for comparison. Finally the connection to MATLAB is closed.
...
Chances are that you might be looking for whether MATLAB-EVIEWS combination works best for you. If that is the case, perhaps you should take a look at the quora thread above.
...
You may also want to consider using EViews native programming capabilities to run analysis on your data recursively in conjunction with using Matlab to handle matrix data.
...
After creating a connection to EViews from Matlab, at the very least, you could write your program in EViews and then call it from Matlab* using the shell:
system(['"C:\Program Files\EViews 9\EViews9_x64.exe" "C:\Users\me\Documents\foo.prg"'])
*or Stata, R, Python, VBA, etc.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by