我有一個顏色數組,我要轉換爲數字矩陣陣列:轉換爲轉換陣列花車
using Colors
cols = [RGB{Float64}(rand(), rand(), rand()) for i in 1:6]
6-element Array{ColorTypes.RGB{Float64},1}:
RGB{Float64}(0.836012,0.505908,0.249548)
RGB{Float64}(0.383172,0.105153,0.361422)
RGB{Float64}(0.680616,0.974232,0.942787)
RGB{Float64}(0.804829,0.825503,0.990222)
RGB{Float64}(0.0404051,0.569093,0.772053)
RGB{Float64}(0.872298,0.704112,0.473588)
:
6×3 Array{Float64,2}:
0.836012 0.505908 0.249548
0.383172 0.105153 0.361422
0.680616 0.974232 0.942787
0.804829 0.825503 0.990222
0.0404051 0.569093 0.772053
0.872298 0.704112 0.473588
我會怎麼做那?
謝謝!我總是想知道「重新解釋」是什麼 - 它看起來非常有用! – daycaster
是的,它完全沒有複製數據,所以它會成爲最快的方法!但請注意,因爲這意味着修改重新解釋的數組也會影響您的'RGB'數組。 –