Calling Eviews program from Matlab

For questions regarding programming in the EViews programming language.

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

rloc
Posts: 7
Joined: Mon May 07, 2012 6:07 am

Calling Eviews program from Matlab

Postby rloc » Mon Jul 30, 2012 9:46 am

I have set up a connection to Eviews from matlab with the following:

hm = actxserver('Eviews.Manager');
ha = hm.GetApplication;

I can successfully run Eviews commands one at a time with, for example,

ha.Run('rets.genr retd? = log(cum_?) - log(cum_?(-1))');

but since the one command at a time surrounded by ha.Run etc was tedious and also precluded local variables, loops and if's, I tried calling an entire Eviews program from Matlab using

ha.Run('run(v) "c:\models\drr\eviews\getretdata.prg"'); The program works fine in Eviews, but I get the following error when the command is invoked from Matlab

??? Error: The RPC server is unavailable.

Question: How do I run a whole Eviews program from Matlab?

PS I have gone the other way and have run Matlab functions from Eviews.

EViews Steve
EViews Developer
Posts: 844
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Calling Eviews program from Matlab

Postby EViews Steve » Mon Jul 30, 2012 12:01 pm

I just tried this using Matlab 7.9.0 (R2009b) and it worked fine for me.

Perhaps it's something in the program? Try running the program from a VBA client like Excel or Word. See if an error appears.

If Excel or Word can call the EViews program but Matlab cannot, then it's an issue with Matlab...

Steve

rloc
Posts: 7
Joined: Mon May 07, 2012 6:07 am

Re: Calling Eviews program from Matlab

Postby rloc » Tue Jul 31, 2012 6:54 am

Thanks Steve. It worked today. I must have had a contamintaed connection yesterday.

Today's question: Is there any documentation about what the various commands (eg GetGroup v. GetGroupEx) do? I have been guessing based on the names, but it would be nice to know options etc.

In particular, I have been using GetGroup to retrieve a Group of series from Eviews to Matlab. In Matlab, it creates a cell array, but it effectively only a matrix of numbers. I lose the dates and the headers. Is there any option to retrieve all Group data including series names and date associated with number. IE what looks like an Eviews Group.

EViews Steve
EViews Developer
Posts: 844
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Calling Eviews program from Matlab

Postby EViews Steve » Tue Jul 31, 2012 7:33 am

We provide a whitepaper on our website that provides those details.

http://eviews.com/download/whitepapers/ ... mation.pdf

Steve

EViews Steve
EViews Developer
Posts: 844
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Calling Eviews program from Matlab

Postby EViews Steve » Tue Jul 31, 2012 7:47 am

About the GetGroup call, try this to get the date column:

Code: Select all

app.GetGroup("@date series1 series2", ...
The "@date" value should return the dates you are looking for. Unfortunately, there isn't a way to get the series names (column headers) in the GetGroup output -- however, you can do a Lookup call before calling GetGroup to get the list of names beforehand. Look at the bottom of page 3 of the PDF documentation...

Once you have each name, they should match the output of GetGroup (except for the @date column).

Steve

eclee
Posts: 9
Joined: Sat Oct 05, 2013 3:25 am

Re: Calling Eviews program from Matlab

Postby eclee » Sat Oct 05, 2013 6:48 pm

Hi, All:
I wrote the following script [part] to call EViews (64 bit) from Matlab 2013a (64 bit) four months ago.
It was workable before, but it is failed now. I don't change anything. May anyone help me to solve this problem? Thanks!

Code: Select all

clear all; clc; hm = actxserver('Eviews.Manager') hm = COM.Eviews_Manager h = hm.GetApplication(0) % h = Interface.EViews_1.0_Type_Library.IApplication % EViews 7 % h = Interface.EViews_8.0_Type_Library.IApplication % EViews 8 h.invoke h.Show() h.Run('wfcreate comEV u 4') h.Run('genr x = @obsid')
[Error Messenge]

h = hm.GetApplication(0)

No appropriate method, property, or field GetApplication for class
COM.Eviews_Manager.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests