Ejemplo n.º 1
0
        public void UncompressedTest()
        {
            var matFile = new DotMatFile();

            matFile["greeting"] = new MatlabString("Hello, World!");
            var filename = Path.GetRandomFileName() + ".mat";

            matFile.WriteToDisk(filename);
            // File.Delete(filename);
        }
Ejemplo n.º 2
0
        public void NullBufferTest()
        {
            var matfile = new DotMatFile();

            int[] buffer = null;
            var   matrix = new MatlabMatrix(buffer);

            matfile["nullData"] = matrix;
            matfile.WriteToDisk("nullData.mat");
        }
Ejemplo n.º 3
0
        public void EmptyKeyDictionaryTest()
        {
            var matfile  = new DotMatFile();
            var emptyKey = new Dictionary <string, MatrixElement> {
                { string.Empty, new MatlabString("empty key") }
            };
            var structure = new MatlabStructure(emptyKey);

            matfile["structEmptyKey"] = structure;
            matfile.WriteToDisk("structEmptyKey.mat");
        }
Ejemplo n.º 4
0
        public void CellWithCellTest()
        {
            var matfile   = new DotMatFile();
            var outerCell = new MatlabCell();
            var innerCell = new MatlabCell();

            innerCell.Contents.Add(new MatlabString("Hello, World!"));
            outerCell.Contents.Add(innerCell);
            matfile["cellCell"] = outerCell;
            matfile.WriteToDisk("cellCell.mat");
        }
Ejemplo n.º 5
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");
        }
Ejemplo n.º 6
0
        public void InvalidPathTest()
        {
            var matFile = new DotMatFile();

            matFile.WriteToDisk("q:\\unlikelydirectory\\foo.mat");
        }
Ejemplo n.º 7
0
        public void EmptyFilenameTest()
        {
            var matFile = new DotMatFile();

            matFile.WriteToDisk(string.Empty);
        }
Ejemplo n.º 8
0
        public void NullFilenameTest()
        {
            var matFile = new DotMatFile();

            matFile.WriteToDisk(null);
        }