I have a loop which run about 300,000 times at every iteration I stored:
time_elps = stwt.Elapsed.TotalMilliseconds
read.Add(time_elps, OFV_best)
Finally I just want to take the values of read
(a dictionary of course) to draw a graph on excel.
I tried to export this data to excel:
oxl = CreateObject("Excel.application")
oxl.Visible = True
owb = oxl.Workbooks.Add
osheet = owb.ActiveSheet
For i = 0 To 100
osheet.Cells(i + 1, 1).Value = read.Item(read.Keys.ElementAt(i))
osheet.Cells(i + 1, 2).value = read.Keys.ElementAt(i)
Next
and to a text file:
objStreamWriter = New StreamWriter("C:\Users\Dr. Mohamed ElWakil\Desktop\data.txt")
For i = 0 To read.Count - 1
objStreamWriter.WriteLine(CStr(read.Item(read.Keys.ElementAt(i)) & "," & (read.Keys.ElementAt(i))))
Next
objStreamWriter.Close()
In two cases it takes too too much time, it's longer than the time of running the code itself.
What do you suggest to get my data easily and fast?