Question

Let us consider an array which could be given by AA = [1] or by AA= [1 2]. Thus, we don't know beforehand its dimensions.

We can extract the minimum dimension in Matlab using:

min(size(AA))

What commands should I use in Julia? A similar approach would lead to an error:

m,n=size(AA,1),size(AA,2)

minimum(m,n)

it seems that Julia computes the minimum of a collection and it would not see (m,n) as a collection.

Was it helpful?

Solution

Doing

minimum(size(A))

just works.

size(A) returns a tuple which is seen as a collection. To get the minimum of several arguments one can use min(m,n).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top