Exemplo n.º 1
0
        public void CellWithStructure()
        {
            var matfile = new DotMatFile();
            var cell    = new MatlabCell();
            var mapping = new Dictionary <string, MatrixElement>();

            mapping.Add("bits", new MatlabMatrix(new byte[] { 1, 2, 4, 8, 16, 32, 64, 128 }));
            var names = new MatlabCell(new[] { 8, 1 });

            names.Contents.Add(new MatlabString("one"));
            names.Contents.Add(new MatlabString("two"));
            names.Contents.Add(new MatlabString("four"));
            names.Contents.Add(new MatlabString("eight"));
            names.Contents.Add(new MatlabString("sixteen"));
            names.Contents.Add(new MatlabString("thirty-two"));
            names.Contents.Add(new MatlabString("sixty-four"));
            names.Contents.Add(new MatlabString("one twenty-eight"));
            mapping.Add("names", names);
            var structure = new MatlabStructure(mapping);

            cell.Contents.Add(structure);
            matfile["cellStructure"] = cell;
            matfile.WriteToDisk("cellStructure.mat");
        }