I wonder if there is a way of looping through a number of arrays of different sizes and trimming data from the beginning of each array in order to achieve the same amount of elements in each array?

For instance, if I have:

```
 A = [4     3     9     8    13]
 B = [15     2     6    11     1    12     8     9    10    13     4]
 C = [2     3    11    12    10     9    15     4    14]

```

and I want B an C to lose some elements at the beginning, such that they end up being 5 elements in length, just like A, to achieve:

```
 A = [4     3     9     8    13]
 B = [8     9    10    13     4]
 C = [10     9    15     4    14]

```

How would I do that?

EDIT/UPDATE:

I have accepted the answer proposed by @excaza, who wrote a nice function called "naivetrim". I saved that function as a .m script and then used it: First I define my three arrays and, as @excaza suggests, called the function: 

```
 [A, B, C] = naivetrim(A, B, C);

```

Another solution variation that worked for me - based on @Sardar\_Usama's answer below (looping it). I liked this as well, because it was a bit more straightforward (with my level, I can follow what is happening in the code)

```
A = [4     3     9     8    13]
B = [15     2     6    11     1    12     8     9    10    13     4]
C = [2     3    11    12    10     9    15     4    14]

arrays = {A,B,C}

temp = min([numel(A),numel(B), numel(C)]);  %finding the minimum number of elements
% Storing only required elements

for i = 1:size(arrays,2)
    currentarray = arrays{i}
    arrays(i) = {currentarray(end-temp+1:end)}
end

```