假設我有一個像下面這樣的矩陣數組。我想訪問每個矩陣的每個第一個元素,並將其賦予變量a,並將每個矩陣的每個第二個元素賦給變量b,然後繼續執行c,d,e ...我想繪製a,b,c ...單獨查看差異,這就是爲什麼我需要將其提取到單獨的變量。在Python中訪問矩陣列表的各個列
[matrix([[-0.92041113],
[ 1.08098058],
[ 0.14296712],
[ 0.68220346],
[-2.06009246],
[ 2.67064141],
[ 0.02112063],
[-3.10444805],
[ 2.65878653],
[-2.07589813],
[-2.06215593],
[ 0.85664044],
[-3.74867982]]),
matrix([[-0.92040691],
[ 1.08097285],
[ 0.14295496],
[ 0.68220521],
[-2.06007836],
[ 2.67064582],
[ 0.02111738],
[-3.10443457],
[ 2.65875017],
[-2.07586394],
[-2.06215174],
[ 0.85664019],
[-3.74867324]]),
matrix([[-0.92040268],
[ 1.08096513],
[ 0.1429428 ],
[ 0.68220696],
[-2.06006425],
[ 2.67065023],
[ 0.02111412],
[-3.1044211 ],
[ 2.65871382],
[-2.07582975],
[-2.06214755],
[ 0.85663994],
[-3.74866666]]),
matrix([[-0.92039846],
[ 1.08095741],
[ 0.14293065],
[ 0.68220871],
[-2.06005015],
[ 2.67065464],
[ 0.02111087],
[-3.10440762],
[ 2.65867747],
[-2.07579557],
[-2.06214336],
[ 0.8566397 ],
[-3.74866008]])]
以下是我的努力,
[beta_array[i][0] for i in range(0,3)]
但我得到的輸出類似如下,
[matrix([[-0.92041113]]),
matrix([[-0.92040691]]),
matrix([[-0.92040268]]),
matrix([[-0.92039846]])]
我不能夠與該輸出密謀什麼。我的理想輸出是變量a中的(-0.92041113,-0.92040691,-0.92040268,-0.92039846),並且它是1。如果它是一個值的適當變量,我可以很容易地繪製它。有人能幫我做這件事嗎?
感謝它的工作! – haimen