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:
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:
Returns: It returns the concatenated array.
Example:
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:
Returns: It returns the concatenated array.
Example:
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:
a, b, c, d = 5 , 10 , 15 , 20
[a b; c d]
hvcat(( 2 , 2 ), a, b, c, d)
|
Output:
