I was writing a code on MATLAB where by mistake, I wrote this line:
x = rand(1:3)
And I got the following output:
Can someone explain to me what is going on here? Is it a 3D matrix? Or something else?
It creates a 3 dimensional random array
x = rand(1:3)
is same as
x = rand([1,2,3])
you can change the values such that
x = rand([3,2,3])
will create a 3x2x3
elements of random array
Here is a well defined explanation of what rand function does