MATLAB: How to make vectors from two points vectors

MATLABmatrix arraymatrix manipulation

In one dimension, I could make a vector interpolates between two points by using ':' operator.
For example:
> index1 = 1;
> index2 = 10;
> vec = [index1:index2]
vec =
1 2 3 4 5 6 7 8 9 10
However, I can't make multiple vectors interpolated from the vector of two points.
What should I write in the following '???'.
> index1 = [1; 11, 21];
> index2 = [10; 20; 30];
> vecs = ??? % don't write: [index1(1):index2(1); index1(2):index2(2); index1(3):index2(3)]
vec =
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30

Best Answer

index1 = [1; 11; 21];
index2 = [10; 20; 30];
mat = cell2mat(arrayfun(@(x1,x2)x1:x2,index1,index2,'UniformOutput',false));