Concatenation of arrays in Julia - cat(), vcat(), hcat() and hvcat() Methods Last Updated : 01 Apr, 2020 Comments Improve Suggest changes Like Article Like Report The cat() is an inbuilt function in julia which is used to concatenate the given input arrays along the specified dimensions in the iterable dims. Syntax: cat(A...; dims=dims) Parameters: A: Specified arrays. A: Specified dimensions. Returns: It returns the concatenated array. Example: Python # Julia program to illustrate # the use of cat() method # Getting the concatenated array a = [1, 2, 3, 4] b = [5, 10, 15, 20] cat(a, b, dims =(2, 2)) Output: vcat() The vcat() is an inbuilt function in julia which is used to concatenate the given arrays along dimension 1. Syntax: vcat(A...) Parameters: A: Specified arrays. Returns: It returns the concatenated array. Example: Python # Julia program to illustrate # the use of vcat() method # Getting the concatenated array a = [5 10 15 20] b = [2 4 6 8; 1 3 5 7] vcat(a, b) Output: hcat() The hcat() is an inbuilt function in julia which is used to concatenate the given arrays along dimension 2. Syntax: hcat(A...) Parameters: A: Specified arrays. Returns: It returns the concatenated array. Example: Python # Julia program to illustrate # the use of hcat() method # Getting the concatenated array a = [5; 10; 15; 20; 25] b = [1 2; 3 4; 5 6; 7 8; 9 10] hcat(a, b) Output: hvcat() The hvcat() is an inbuilt function in julia which is used to concatenate the given arrays horizontally and vertically in one call. The first parameter specifies the number of arguments to concatenate in each block row. Syntax: hvcat(rows::Tuple{Vararg{Int}}, values...) Parameters: rows: Specified block row. values: Specified values. Returns: It returns the concatenated array. Example: Python # Julia program to illustrate # the use of hvcat() method # Getting the concatenated array a, b, c, d = 5, 10, 15, 20 [a b; c d] hvcat((2, 2), a, b, c, d) Output: Comment More infoAdvertise with us Next Article Concatenation of arrays in Julia - cat(), vcat(), hcat() and hvcat() Methods K Kanchan_Ray Follow Improve Article Tags : Julia Similar Reads Counting number of elements in an array in Julia - count() Method The count() is an inbuilt function in julia which is used to count the number of elements in the specified array for which the given predicate p returns true and if p is omitted, counts the number of true elements in the given collection of boolean values. Syntax: count(p, itr) or count(itr) Paramet 2 min read Getting an array of all items of a collection in Julia - collect() Method The collect() is an inbuilt function in julia which is used to return an array of all items in the specified collection or iterator. Syntax: collect(collection) or collect(element_type, collection) Parameters: collection: Specified collection or iterator. element_type: Specified type of elements. Re 1 min read Creating a copy of elements from a collection to an array in Julia - copyto!() Method The copyto!() is an inbuilt function in julia which is used to copy all elements from the specified collection src to array dest. Syntax: copyto!(dest::AbstractArray, src) Parameters: dest::AbstractArray: Specified destination array. src: Specified source collection. Returns: It returns the copied e 1 min read Iterating over each index of array in Julia - eachindex() Method The eachindex() is an inbuilt function in julia which is used to create an iterable object for visiting each index of the specified array. Syntax: eachindex(A...) Parameters: A: Specified array. Returns: It returns an iterable object for visiting each index of the specified array. Example 1: Python 2 min read Getting first element of an array in Julia - first() Method The first() is an inbuilt function in julia which is used to return the first element of the specified iterable collection. Syntax: first(coll) Parameters: coll: Specified iterable collection. Returns: It returns the first element of the specified iterable collection. Example 1: Python # Julia progr 1 min read Get dimensions of array in Julia - ndims() Method The ndims() is an inbuilt function in julia which is used to return the number of dimension of the specified array A. Syntax: ndims(A::AbstractArray) Parameters: A: Specified array Returns: It returns the number of dimension of the specified array A. Example 1: Python # Julia program to illustrate # 1 min read Broadcasting a function over collections in Julia - broadcast() and broadcast!() Methods The broadcast() is an inbuilt function in julia which is used to broadcast the function f over the specified arrays, tuples or collections. Syntax: broadcast(f, As...) Parameters: f: Specified function. As: Specified arrays, tuples or collections. Returns: It returns the results of the process of br 2 min read Get array dimensions and size of a dimension in Julia - size() Method The size() is an inbuilt function in julia which is used to return a tuple containing the dimensions of the specified array. This returned tuple format is (a, b, c) where a is the rows, b is the columns and c is the height of the array. Syntax: size(A::AbstractArray) or size(A::AbstractArray, Dim) P 2 min read Creating a similar type of array in Julia - similar() Method The similar() is an inbuilt function in julia which is used to create an uninitialized mutable array with the given element type and size, based upon the given source array. Syntax: similar(array, element_type=eltype(array), dims=size(array)) Parameters: array: Specified arrays. element_type: Specif 1 min read Like