string filePath = Application.dataPath + "/data.txt";
using (StreamWriter writer = new StreamWriter(filePath))
{
for (int row = 0; row < 50; row++)
{
for (int col = 0; col < 50; col++)
{
writer.Write(densityfct[row, col].ToString("F2")); // F2表示保留两位小数
if (col < 49)
{
writer.Write(",");
}
}
writer.WriteLine();
}
}