MATLAB: Does the PutWorkspaceData method of the MATLAB 7.0 (R14) COM interface work incorrectly for indexed arrays or structural arrays

actxserverautomationbasicMATLABputworkspacedataservervisual

I am using MATLAB as an ActiveX/COM server. I am trying to put a structural array into the MATLAB workspace using the PutWorkspaceData function as in the following code:
h.PutWorkspaceData('SArray.f1','base',1)
This works without an error, but the data that is put in the MATLAB workspace is inaccesable. I have also tried the following with the same results:
h.PutWorkspaceData('a(1)','base',1)

Best Answer

This bug has been fixed in Release 14 Service Pack 2 (R14SP2). For previous releases, please read below for any possible workarounds:
We have verified that there is a bug in the PutWorkspaceData method in the way that it handles non-simple variable names. This problem appears when PutWorkspaceData is passed a variable name with non-alphabetic characters in it, as when referencing a structure field. To work around this issue, try using the Execute method instead of PutWorkspaceData. An example of how to do this is below:
a = 1;
b = 'hello';
%Start Matlab as an automation server
h = actxserver('matlab.application');
%Put a structure array and an indexed array into the workspace
h.Execute(['test.f1 =' num2str(a)]);
h.Execute(['test.f2 =''' b '''']);