time , qm_rate , qf_rate, q_rate, q_cum for wells, gas in place,
0.10000E+01, 0.33399E+03, 0.50738E+00, 0.33450E+03, 0.33450E+03, 0.13241E+10,
0.30000E+01, 0.27955E+03, 0.46475E+00, 0.28002E+03, 0.89453E+03, 0.13241E+10,
0.70000E+01, 0.21779E+03, 0.42840E+00, 0.21821E+03, 0.17674E+04, 0.13241E+10,
0.15000E+02, 0.15937E+03, 0.38367E+00, 0.15975E+03, 0.30454E+04, 0.13241E+10,
0.31000E+02, 0.11270E+03, 0.33442E+00, 0.11304E+03, 0.48540E+04, 0.13241E+10,
(粘贴以后没有对齐,上原图)
有这样格式的一组数据 存在TXT中
如何打开它并且
读取从第二行开始的数据赋值给一个二维数组
哪位能不能帮帮忙最好详细点 新手 实例最好
据我统计在一行数据中
数据的第一个数字都是0而且位置在这一行中是固定的 数据的长度也是固定的小数点后边5位
是不是可以将一行看成一个字符串读取固定位置的字符(不知道空格算不算字符)
------解决思路----------------------
Dim path As String = "路径"
Dim data As String() = File.ReadAllLines(path)
Dim list As List(Of List(Of Double)) = New List(Of List(Of Double)) '得到的二维数组
For i As Integer = 1 To data.GetUpperBound(0)
list.Add(New List(Of Double))
Dim tempData() As String = Split(data(i), ",")
For j As Integer = 0 To tempData.GetUpperBound(0)
If Trim(tempData(j)) <> "" Then
Dim value As Double = Convert.ToDouble(Trim(tempData(j)))
list(list.Count - 1).Add(value)
End If
Next
Next
------解决思路----------------------
一行行读取,然后用Regex.Split(txt,@"\s+")分割不就行了?