How do I transpose a matrix of strings?

#1

I can transpose a numerical matrix

transpose([1,2]) # column vector to row vector

but I can’t do the same for string matrix

transpose(["a","b"]) #error

Why is this and how can I fix it?

0 Likes

#2
julia> A = [('a'-1+i) * ('a'-1+j) for i in 1:3, j in 1:3]
3×3 Array{String,2}:
 "aa"  "ab"  "ac"
 "ba"  "bb"  "bc"
 "ca"  "cb"  "cc"

julia> permutedims(A)
3×3 Array{String,2}:
 "aa"  "ba"  "ca"
 "ab"  "bb"  "cb"
 "ac"  "bc"  "cc"
4 Likes