ones(2)
, rand(2)
etc all do what you want and return a vector. The way to think about it is that the number of arguments you pass to them is the number of dimensions you want the output to have.
9 Likes