开发者

How to pass cell array from MATLAB to .NET method

I am new to MATLAB. By using the command NET.addAssembly I am loading a .NET assembly, instantiating an object of assembly's class, then I am invoking the methods of the class.

Passing parameters such as double, char to method of assembly class is working fine.

But when I am trying to pass cell array to method of instantiated class, it shows an error parameter mismatch.

I have done the following procedure:

s = NET.addAssembly('name of assembly')
t = s.AssemblyHandle.GetType('Class present in assembly');
obj = System.Activator.CreateInstance(t);
obj.PassCellArray(CellArray);

.NET Method

public void PassCellArray(System.Object[] dd) {}

Accordin开发者_如何转开发g to the documentation, we can pass the cell array to a method which has parameter as System.Object[].

So please help me for how to pass cell array to .NET method.


What exactly is stored inside this cell-array?

According to the documentation, elements of a cell can be any of the following supported types:

  • Any non-sparse, non-complex built-in numeric type shown in the Primitive Type Conversion Table
  • char
  • logical
  • cell array
  • .NET object

While you cannot pass the following MATLAB types to .NET methods:

  • Structure arrays
  • Sparse arrays
  • Complex numbers
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜