matlab xget

For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

startz
Non-normality and collinearity are NOT problems!
Posts: 3797
Joined: Wed Sep 17, 2008 2:25 pm

matlab xget

Postby startz » Wed Oct 06, 2010 2:49 pm

If you try to xget a structure from Matlab, EViews brings in a scalar with the wrong value. It should probably error.

If you type

Code: Select all

xget(type=structure) a
the error alert is too small and the title bar is truncated.

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

Re: matlab xget

Postby EViews Steve » Thu Oct 07, 2010 11:22 am

Actually, the type=structure is invalid but our error message wasn't displaying properly. I've fixed this in the next patch.

donihue
Posts: 139
Joined: Wed Oct 07, 2009 8:51 am

Re: matlab xget

Postby donihue » Wed Jul 27, 2011 11:42 am

Is there then any way to "xget" a Matlab structure?
Regards
Donihue

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

Re: matlab xget

Postby EViews Gareth » Wed Jul 27, 2011 11:48 am

I believe not.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: matlab xget

Postby EViews Glenn » Wed Jul 27, 2011 2:32 pm

I would assume (but haven't verified) that you should be able to pull the individual elements of the structure as desired...

donihue
Posts: 139
Joined: Wed Oct 07, 2009 8:51 am

Re: matlab xget

Postby donihue » Thu Jul 28, 2011 8:02 am

Perhaps one can, but I have failed... See the attached for one attempt. I also tried various other xget "type=" options, and none at all, with the same result. There may be some other appelation for "M_.params" which works, but "m_.params", "M_params" and "params" do not. And of course using "xget M_" directly just returns a scalar with value "NA".
Regards
Donihue
Attachments
ev_dyn1.jpg
EViews prog and results
ev_dyn1.jpg (50.62 KiB) Viewed 13480 times
ev_dyn2.jpg
Matlab workspace
ev_dyn2.jpg (53.65 KiB) Viewed 13480 times

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

Re: matlab xget

Postby EViews Steve » Thu Jul 28, 2011 8:34 am

I'm pretty sure that if you put M_.params into it's own separate matrix (within MATLAB) first, you can then download that new matrix variable to EViews with an XGET call.

This limitation is due to their own COM interface so it would be something they would have to change in order to allow a call to GetWorkspaceData M_.params (which is what the EViews XGET method calls) to work directly.

Another idea is that there are some MATLAB conversion functions they provide (such as cell2mat) that converts one type into another. Perhaps there is one for converting M_.params into a matrix. So maybe you could call something like

Code: Select all

XGET "cell2mat(M_.params)"
To figure out what class type M_.params is, try this MATLAB command:

Code: Select all

class(M_.params)


This could help figure out why it won't download directly...

Steve

donihue
Posts: 139
Joined: Wed Oct 07, 2009 8:51 am

Re: matlab xget

Postby donihue » Fri Jul 29, 2011 9:31 am

Many thanks for your time, Steve.

The class of M_.params is the same as that of, say, the scalar sigas referenced in my output (namely, "double"), but the command "cell2mat(M_.params)" in Matlab just returns an error:
??? Cell contents reference from a non-cell array object.
Error in ==> cell2mat at 44
cellclass = class(c{1});


This is clearly a Matlab, not an EViews, issue, so I will try to figure out how to "put M_.params into it's own separate matrix (within MATLAB) first" as you suggest ...

Regards
Donihue

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

Re: matlab xget

Postby EViews Steve » Fri Jul 29, 2011 9:48 am

Yeah, the cell2mat was just an example of a function you could use -- and it would only work if the M_.params object was a cell array.

What does class(M_.params) return?

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

Re: matlab xget

Postby EViews Steve » Fri Jul 29, 2011 10:02 am

Nevermind my last question. I was able to replicate the issue...

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

Re: matlab xget

Postby EViews Steve » Fri Jul 29, 2011 10:26 am

It looks like the MATLAB COM interface won't let you use compound statements in the call to GetWorkspaceData. Meaning, you can't call "func(M_.params)" to get your data. And from what I can see, there's no reason why you couldn't just call XGET M_.params aside from this limitation.

So here's what you should do:

Create a temp variable in MATLAB that copies the compound item you want to retrieve like this:

Code: Select all

XRUN "tmp2=M_.params"
Then retrieve it using the name parameter to change the name in EViews:

Code: Select all

XGET(type=vector, name=params) tmp2
Steve

donihue
Posts: 139
Joined: Wed Oct 07, 2009 8:51 am

Re: matlab xget

Postby donihue » Sat Jul 30, 2011 4:37 am

Thank you very much indeed, Steve. That worked a treat!
Regards
Donihue


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 2 guests