This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Convert Nested System.Object Arrays

This example shows how to use the cell function to convert data in nested System.Object arrays.

The conversion of .NET arrays to cell arrays is not recursive for a System.Object array contained within a System.Object array. Use the cell function to convert each System.Object array.

The C# example NetDocCell.cs, in the matlabroot/extern/examples/NET/NetSample folder, is used in the following example. To see the code, open the file in MATLAB® Editor and build the NetDocCell assembly.

Set up the path to your assembly, then load the assembly.

dllPath = fullfile('c:','work','NetDocCell.dll');
NET.addAssembly(dllPath);

Create a cell array, mlData.

graph = NetDocCell.MyGraph;
mldata = cell(graph.getNewData)
mlData = 
    [1x1 System.String]    [1x1 System.Object[]]

To access the contents of the System.Object array, create another cell array mlPlotData.

mlPlotData = cell(mlData{2})
mlPlotData = 
    [1x1 System.String]    [1x1 System.Double[]]

Related Examples

More About