rohan
rohan

Reputation: 21

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) {}

According 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.

Upvotes: 2

Views: 537

Answers (1)

Amro
Amro

Reputation: 124563

What exactly is stored inside this cell-array?

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

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

  • Structure arrays
  • Sparse arrays
  • Complex numbers

Upvotes: 2

Related Questions