|
"Chang shen" <shencs@yahoo.com> schrieb im Newsbeitrag
news:glar39$ri3$1@fred.mathworks.com...
> Hi All,
> I have a class cfoo, How to access its properties from .NET? I defined
> those properties as public but in .NET, I can not see those properties.
> Any wrong?
>
> classdef cfoo
> properties (SetAccess = public, GetAccess = public)
> avalue=0;
> aarray=[0,1];
> end
> method (Access = public)
> function out = myf(obj,in)
> out = in*avalue;
> end
> end
>
> %constructor
> method obj=cfoo(inv, ina)
> obj.avalue=inv;
> obj.aarray = ina;
> end
> end
>
>
> it compiled as .NET component MatlabDotNetDLL. I expected that I can
> access class properties avalue and aarray in .NET, like something
> objecy.property
> But I can not see them. What is wrong?
>
>
>
> C# code:
>
> using MatlabDotNetDLL;
>
> namespace example
> {
> class Program
> {
> static void Main(string[] args)
> {
> int[] aarray = new int[2];
> int avalue=3;
>
> MatlabDotNetDLL myclass = new MatlabDotNetDLL();
> MatlabDotNetDLL aclass = myclass.cfoo((MWArray)avalue,
> (MWArray)aarray);
>
> aclass.avalue=5; //????
> }
> }
> }
Hi,
from the doc (Product Overview of MATLAB Builder NE):
Unsupported MATLAB Data Types
The MATLAB Builder NE product does not support MATLAB object data types (for
example, Time Series Objects) and most unsigned numeric types.
Allthough your MATLAB code may use object data types as you like, passing
the boundary of MATLAB/.NET does not work, i.e., you can call functions in
MATLAB but not directly access objects properties ...
Titus
|