I have a vector
rand(1,10)
and I want to access some of the elements immediately after creating the vector. For example, I can do this by the following code:
A=rand(1,10)
A(2:5)
Using these two lines, I can access the 2nd to 5th elements. However, I must create a variable "A" to do this. Then how can I avoid creating the variable?
I have tried the following codes:
rand(1,10)(2:5)
(rand(1,10))(2:5)
But they both do not work.