Question: I want to concatenate vectors according to another vector values. To simplify question, I'm giving a similar situation:
Let assume I have a cell which it has 3 vectors in it (s\_i):

```
s_1 = [1 2 3];
s_2 = [2 1 3];
s_3 = [3 1 2];

s_i  = {s_1, s_2 , s_3 } ;

bits = [1 2 1 3 1];

```

So I want to create a new vector which is 

```
new_vector = [s_1 s_2 s_1 s_3 s_1];

```

My data is not small as I gave in example. Thank you in advance.

Answer: 
It's very simple:

```
new_vector = [s_i{bits}]

```
Try this:

```
new_vector = cell2mat(s_i(bits))

```

---

Result with the above test case:

```
new_vector =

     1     2     3     2     1     3     1     2     3     3     1     2     1     2     3

```