public void UncompressedTest() { var matFile = new DotMatFile(); matFile["greeting"] = new MatlabString("Hello, World!"); var filename = Path.GetRandomFileName() + ".mat"; matFile.WriteToDisk(filename); // File.Delete(filename); }
public void NullBufferTest() { var matfile = new DotMatFile(); int[] buffer = null; var matrix = new MatlabMatrix(buffer); matfile["nullData"] = matrix; matfile.WriteToDisk("nullData.mat"); }
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"); }
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"); }
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"); }
public void InvalidPathTest() { var matFile = new DotMatFile(); matFile.WriteToDisk("q:\\unlikelydirectory\\foo.mat"); }
public void EmptyFilenameTest() { var matFile = new DotMatFile(); matFile.WriteToDisk(string.Empty); }
public void NullFilenameTest() { var matFile = new DotMatFile(); matFile.WriteToDisk(null); }