Vector of structs -- push/append/?

I’m trying to create and load a music note (a struct “Note”) into an array representing 16 tracks of music. The declaration: sequence = Note works perfectly and I’ve been able to add notes to sequence by using: push!(sequence, Note). Now I need to create an array for 16 tracks of sequences, like:

tracks[1] = a sequence
tracks[2] = a sequence

tracks[16] = a sequence

The expression: tracks = Array{Vector{Note}, 16} seems appropriate and doesn’t throw an error but I haven’t been able to find a way to load a sequence onto a track without an error. I’ve tried push! and append!, as in:

push!(tracks[1], Note)

It calls the typeof(tracks) a DataType and throws the error:

ERROR: LoadError: MethodError: Cannot convert an object of type Int64 to an object of type Array{Array{Note,1},16}

I’d be most grateful for ideas! Thanks.

Your tracks expression is wrong, the length 16 shouldn’t be part of the type. You can do tracks = [Note[] for _ in 1:16] to make sixteen separate empty vectors for example


Thank you Jules!!!