Home > Software engineering >  Using vb to read the second column of the minimum dat file, then I'm going to use the minimum v
Using vb to read the second column of the minimum dat file, then I'm going to use the minimum v

Time:09-25

0 0
0.07.773505 e-06 50 0.0
1.554701 e-05 100 0.0
2.332052 e-05 150 0.0
3.109402 e-05 200 0.0
3.886753 e-05 250 0.0
4.664103 e-05 300 0.0
5.441453 e-05 350 0.0
6.218804 e-05 400 0.0
6.996154 e-05 450 0.0
7.773505 e-05 500 0.0
8.550855 e-05 550 0.0
9.328206 e-05 600 0.0
1.010556 e-04 650 0.0
1.088291 e-04 700 0.0
1.166026 e-04 750 0.0
1.243761 e-04 800 0.0
1.321496 e-04 850 0.0
1.399231 e-04 900 0.0
1.476966 e-04 950 0.0
1.554701 e-04 1000 0.0
1.632436 e-04 1050 0.0
1.710171 e-04 1100 0.0
1.787906 e-04 1150 0.0
1.865641 e-04 1200 0.0
1.943376 e-04 1250 0.0
2.021111 e-04 1300 0.0
2.098846 e-04 1350 0.0
2.176581 e-04 1400 0.0
2.254316 e-04 1450 0.0
2.332052 e-04 1500 0.0
2.409787 e-04 1550 0.0
2.487522 e-04 1600 0.0
2.565257 e-04 1650 0.0
2.642992 e-04 1700 0.0
2.720727 e-04 1750 0.0
2.798462 e-04 1800 0.0
2.876197 e-04 1850 0.0
2.953932 e-04 1900 0.0
3.031667 e-04 1950 0.0
3.109402 e-04 2000 0.0
50 0 0.0
49.99999 50 0.0
49.99998 100 0.0
49.99998 150 0.0

CodePudding user response:

 Private Sub Command1_Click () 
Dim strLine As String, strItem () As String, n As Integer

Open "c: \ test \ test dat" For Input As # 1
N=30000
Do Until EOF (1)
The Line Input # 1, strLine

StrLine=Trim (strLine)
StrLine=Replace (strLine, Space (4), Space (1))
StrLine=Replace (strLine, Space (2), Space (1))

StrItem=Split (strLine, Space (1))

If (n & gt; Val (strItem (1))) Then n=Val (strItem (1))

'the Debug. Print "" "" & amp; StrLine & amp; "" "", strItem (1), n
Loop
Close # 1

The Debug. Print "min=" & amp; N
End Sub
  • Related