I'd like to write a code to convert the array. The base array is a kind of permutated array, which has arrays inside as components.
el = {[0, 0, 0], [1, 0, 0], [0, 0, 1] ... [4, 4, 3], [4, 3, 4], [3, 4, 4], [4, 4, 4]}
125-element Array{Array{Int64,1},1}:
em = {"[0, 0, 0]", "[1, 0, 0]", "[0, 0, 1]" ... "[4, 4, 3]", "[4, 3, 4]", "[3, 4, 4]", "[4, 4, 4]"}
125-element Array{String,1}:
It represents how many stepped forward groups have.
And there is a sort of dataframe
3×3 Named Array{String,2}.; I used NamedArrays
to depict its row name.
OrderNA =
|row name |Start | 1st | 2nd | 3rd |Finish|
|:-------- |:----:|:----:|:----:|:----:| ----:|
| G1 | "Stt"| "W1" | "W2" | "W3" | "Fin"|
| G2 | "Stt"| "W2" | "W3" | "W1" | "Fin"|
| G3 | "Stt"| "W3" | "W1" | "W2" | "Fin"|
As you can see, It's a order table.
As mentioned, El's components represents location of groups.
And should be converted with the order table.
eg) [0,0,0] is location of [G1, G2, G3] => ["Stt","Stt","Stt"]
[1,0,0] => ["W1", "Stt", "Stt"]
[1,2,4] => ["W1", "W3", "Fin" ]
So I've struggled to convert it as described below, but I failed.
function trans(em)
for i in 1:length(em)
for j in 1:length(em[i])
@show em[i][j]
if em[i][3j-1] == '0'
replace(em[i][3j-1]) = "Stt"
elseif em[i][3j-1] == '1'
replace(em[i][j]) = OrderNA[j, 1]
elseif em[i][3j-1] == '2'
replace(em[i][3j-1]) = OrderNA[j, 2]
elseif em[i][3j-1] == '3'
replace(em[i][3j-1]) = OrderNA[j, 3]
else em[i][3j-1] == '4'
replace(em[i][3j-1]) = "Fin"
end
end
end
end
syntax: ""em[i][((3 * j) - 1)]" is not a valid function argument name around In[90]:9
I can't figure out what wrong is. How can I solve this? Thank you in advance!
else
that's what the error is referring to. – niczky12