Page 1 of 1
matlab xget
Posted: Wed Oct 06, 2010 2:49 pm
by startz
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
the error alert is too small and the title bar is truncated.
Re: matlab xget
Posted: Thu Oct 07, 2010 11:22 am
by EViews Steve
Actually, the type=structure is invalid but our error message wasn't displaying properly. I've fixed this in the next patch.
Re: matlab xget
Posted: Wed Jul 27, 2011 11:42 am
by donihue
Is there then any way to "xget" a Matlab structure?
Regards
Donihue
Re: matlab xget
Posted: Wed Jul 27, 2011 11:48 am
by EViews Gareth
I believe not.
Re: matlab xget
Posted: Wed Jul 27, 2011 2:32 pm
by EViews Glenn
I would assume (but haven't verified) that you should be able to pull the individual elements of the structure as desired...
Re: matlab xget
Posted: Thu Jul 28, 2011 8:02 am
by donihue
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
Re: matlab xget
Posted: Thu Jul 28, 2011 8:34 am
by EViews Steve
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
To figure out what class type M_.params is, try this MATLAB command:
This could help figure out why it won't download directly...
Steve
Re: matlab xget
Posted: Fri Jul 29, 2011 9:31 am
by donihue
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
Re: matlab xget
Posted: Fri Jul 29, 2011 9:48 am
by EViews Steve
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?
Re: matlab xget
Posted: Fri Jul 29, 2011 10:02 am
by EViews Steve
Nevermind my last question. I was able to replicate the issue...
Re: matlab xget
Posted: Fri Jul 29, 2011 10:26 am
by EViews Steve
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:
Then retrieve it using the name parameter to change the name in EViews:
Code: Select all
XGET(type=vector, name=params) tmp2
Steve
Re: matlab xget
Posted: Sat Jul 30, 2011 4:37 am
by donihue
Thank you very much indeed, Steve. That worked a treat!
Regards
Donihue