C# 读取asc文件
-
读取asc文件
读取文件头和数据:
/// <summary>
/// 读取asc文件
/// </summary>
/// <param name="path">需要读入的asc文件</param>
/// <param name="data">asc文件数据</param>
/// <param name="head">asc文件文件头</param>
public static void readAsc(string path, out double[][] data, out string head)
{
data = null;
head = "";
if (File.Exists(path))
{
string[] st = File.ReadAllLines(path);
//文件头
for (int i = 0; i < 6; i++)
{
head += st[i] + "\n";
}
//文件数据
data = new double[st