bennykelly13
11-16-2010, 11:17 AM
I am having a problem with a simple loop,but I cant seem to get it to work.Basically I have a function Currentcalculator taking in a number of predefined parameters plus changing parameters for V and T from an excel spreadsheet.The spreadsheet is in the format shown.
Temperature
Wind 1 2 3 4 5
1
2
3
4
I want to take a wind speed of 1,2,3,4 and temp of 1 and print the results to excel, then take wind speed of 1,2,3,4 and temp of 2,then a temp of 3,4 etc.Can anyone help me?here is my code
x1 = win32com.client.Dispatch('Excel.Application')
x1.Visible = 1
x1Wb = x1.Workbooks.Open('current calc.xlsx')
point = x1.Cells
row, col = 0, 0
V = ()
T = ()
i = 3
j = 3
k = 2
while i < 28:
while k < 8:
cells = point(i,1)
Wind = int(cells.Value)
V = Wind
cells = point(2,k)
Temp = cells.Value
T = Temp
dlr = Currentcalculator(T,80,V,45,0.00403,0.01813,0.5,0.5,0.000123,0.000183,75,20,900,100)
cells = point(j,k)
cells.Value = dlr
cells = point(j,k)
if i<28:
i = i+1
j = j+1
## if k < 6:
break
k = k+1
Temperature
Wind 1 2 3 4 5
1
2
3
4
I want to take a wind speed of 1,2,3,4 and temp of 1 and print the results to excel, then take wind speed of 1,2,3,4 and temp of 2,then a temp of 3,4 etc.Can anyone help me?here is my code
x1 = win32com.client.Dispatch('Excel.Application')
x1.Visible = 1
x1Wb = x1.Workbooks.Open('current calc.xlsx')
point = x1.Cells
row, col = 0, 0
V = ()
T = ()
i = 3
j = 3
k = 2
while i < 28:
while k < 8:
cells = point(i,1)
Wind = int(cells.Value)
V = Wind
cells = point(2,k)
Temp = cells.Value
T = Temp
dlr = Currentcalculator(T,80,V,45,0.00403,0.01813,0.5,0.5,0.000123,0.000183,75,20,900,100)
cells = point(j,k)
cells.Value = dlr
cells = point(j,k)
if i<28:
i = i+1
j = j+1
## if k < 6:
break
k = k+1