Array
Array(dims)
Array{T}(dims) constructs an uninitialized dense array with element type T. dims may be a tuple or a series of integer arguments. The syntax Array(T, dims) is also available, but deprecated.
Examples
Create an uninitialized array with specific dimensions:
julia> arr = Array{Int}(3, 2)
3×2 Array{Int64,2}:
4598080 4598128
4598112 4598160
4598144 4598192
This example creates a 3x2 array of type Int with uninitialized elements.
Create an uninitialized array with a single dimension:
julia> arr = Array{Float64}(5)
5-element Array{Float64,1}:
6.94851e-310
6.94851e-310
6.94851e-310
6.94851e-310
6.94851e-310
Here, an uninitialized array with 5 elements of type Float64 is created.
Create an uninitialized array with a tuple of dimensions:
julia> dims = (2, 3, 4);
julia> arr = Array{String}(dims)
2×3×4 Array{String,3}:
[:, :, 1] =
#undef #undef #undef
#undef #undef #undef
[:, :, 2] =
#undef #undef #undef
#undef #undef #undef
[:, :, 3] =
#undef #undef #undef
#undef #undef #undef
[:, :, 4] =
#undef #undef #undef
#undef #undef #undef
In this example, an uninitialized array with dimensions (2, 3, 4) and element type String is created.
Note: The Array(T, dims) syntax is deprecated, and it's recommended to use Array{T}(dims) instead.
See Also
Array, broadcast, cat, combinations, conj!, digits!, fieldnames, fill, fill!, last, length, maximum, minimum, ones, parent, parentindexes, partitions, permutations, pointer, pointer_to_array, promote_shape, rand!, reshape, scale, similar, sum, sum_kbn, takebuf_array, transpose!, vec, zeros,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.