Concatenating two different 1 x n string arrays into a resultant 1 x n string array

Hi,
I’ve got an array called ‘steps = [“C” “G” C"]’ and an array called ‘octaves = [“4” “4” “5”]’
I was wondering of a way in which to combine the two arrays such that the concatenated resultant array ‘notes = [“C4” “G4” “C5”]’.

I’ve tried using hcat(steps, octaves), but that makes the resultant array 2 x n in size, whereas I want the resultant array to be 1 x n in size.

Thanks!

Use broadcasting:

julia> steps = ["C", "G", "C"]; octaves = ["4", "4", "5"];

julia> steps.*octaves
3-element Array{String,1}:
 "C4"
 "G4"
 "C5"

julia> string.(steps, octaves)
3-element Array{String,1}:
 "C4"
 "G4"
 "C5"
6 Likes

Thank you!