Mohammad Saad
Mohammad Saad

Reputation: 2005

Find the number of columns of an array in julia

I have been trying to find the number of columns of an array but apparently the ncols , size, and length functions don't produce the desired output.

Any suggestion on what is the correct way to find the number of columns of an array?

Thanks in advance.

Upvotes: 7

Views: 4374

Answers (1)

DNF
DNF

Reputation: 12664

To find the number of rows of an array, X:

size(X, 1)

To find the number of columns

size(X, 2)

For the length of the n'th dimension:

size(X, n)

Upvotes: 10

Related Questions