In Matlab, everything is a matrix, and the default â€śvectorâ€ť is a 1Ă—n matrix (though not consistently).

In Julia, we have vectors, which are most similar to an nĂ—1 matrix, but they are really a different animal. For most things, a vector is actually what you want, youâ€™re probably expecting a matrix because thatâ€™s what Matlab uses. Try to get used to Julia instead.

This is a UnitRange, which is immutable, it is not an ordinary Vector. Even after transposing, itâ€™s still immutable. If you want to change an element, you must turn it into a Vector first:

Perhaps newcomers can appreciate some explanation of what is going on here. Indeed, by defining A using the colon notation we get a variable that behaves like a vector (or array):

julia> A = 1:1000
1:1000
julia> A[9]
9

The resulting type is actually very memory economical:

julia> sizeof(A)
16

The trick is that this â€śarrayâ€ť is not really stored as an array.

In contrast, using collect we transform the original variable into a true vector (array):