Feb-28-2018, 04:39 PM
Hello, I am currently working on a program to plot some data in Python, and I have a little problem with referencing some values from an array of three dimensions.
Mi code, part of it, is the following:
Could somebody give me an answer why it is not working and how to solve it or make it work?
PD:
I have created a variable to save the values with the following code and with it is working, but I would like to make it work with the original list.
Mi code, part of it, is the following:
for i in range(0,numberOfDistances): print(meanHeatFluxValue[0][i][0]) print(meanHeatFluxValue) print("Uno=",meanHeatFluxValue[0][0][0]) print("Dos=",meanHeatFluxValue[0][1][0]) print("Tres=",meanHeatFluxValue[0][2][0]) print("Cuatro=",meanHeatFluxValue[0][3][0]) print("Cinco=",meanHeatFluxValue[0][4][0]) print("Total=",meanHeatFluxValue[0][0:5][0]) print("Total2=",meanHeatFluxValue[0][:][0]) print(peak1MHF[0:5])and the results in console are:
Output:14.481251700000001
13.911919666666668
10.831539999999999
7.2772367000000004
5.0994235
Uno= 14.481251700000001
Dos= 13.911919666666668
Tres= 10.831539999999999
Cuatro= 7.2772367000000004
Cinco= 5.0994235
Total= [14.481251700000001, 14.271817499999997, 14.1936564, 14.2394419, 14.2713967]
Total2= [14.481251700000001, 14.271817499999997, 14.1936564, 14.2394419, 14.2713967][/inline]
I thought print("Total=",meanHeatFluxValue[0][0:5][0]) print("Total2=",meanHeatFluxValue[0][:][0])give me the values of the 5 first elements, the first one, and all the elements, the later, but it seems it is not working or I have misunderstood it.
Could somebody give me an answer why it is not working and how to solve it or make it work?
PD:
I have created a variable to save the values with the following code and with it is working, but I would like to make it work with the original list.
for d in range (0,numberOfDistances): peak1MHF.append(meanHeatFluxValue[0][d][0]