Get dimensions of array in Julia – ndims() Method
Last Updated :
26 Mar, 2020
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:
A = fill( 1 , 3 );
println(ndims(A))
B = fill( 1 , ( 3 , 3 ));
println(ndims(B))
C = fill( 1 , ( 3 , 1 , 2 ));
println(ndims(C))
|
Output:
Example 2:
A = fill( 1 , 2 , 3 , 4 );
println(ndims(A))
B = fill(( 5 , 10 ), ( 3 , 3 ));
println(ndims(B))
C = fill(( 5 , 10 , 15 ), ( 3 , 1 , 2 ));
println(ndims(C))
|
Output:
Share your thoughts in the comments
Please Login to comment...