public void LabelStoreToFile() { LocalFileAccess lfa = new LocalFileAccess(); if (File.Exists(@"C:\Users\shiya\Desktop\record\LabelMatrix")) { File.Delete(@"C:\Users\shiya\Desktop\record\LabelMatrix"); } File.Create(@"C:\Users\shiya\Desktop\record\LabelMatrix").Close(); for (int i = 0; i < labelMatrix.RowCount; i++) { List <string> rowList = labelMatrix.Row(i).ToList().Select(x => x.ToString()).ToList(); lfa.StoreListToLinesAppend(@"C:\Users\shiya\Desktop\record\LabelMatrix", rowList); } }
public void LabelRetrive() { if (!File.Exists(@"C:\Users\shiya\Desktop\record\LabelMatrix")) { Console.WriteLine("NOT EXISTS"); } LocalFileAccess lfa = new LocalFileAccess(); List <string> rowList = new List <string>(); lfa.StoreLinesToList(@"C:\Users\shiya\Desktop\record\LabelMatrix", rowList); labelMatrix = Matrix <double> .Build.Dense((int)(highbounds[0] - lowbounds[0] + 1), (int)(highbounds[1] - lowbounds[1] + 1)); for (int i = 0; i < labelMatrix.RowCount; i++) { for (int j = 0; j < labelMatrix.ColumnCount; j++) { labelMatrix[i, j] = Convert.ToDouble(rowList[i * labelMatrix.ColumnCount + j]); } } }