Q:

Simply joining two vectors by MatLab

I simply want to create output by applying A and using B as index. For example,
A = [7;9]
B = [0;0;1;1;2]

output = [0;0;7;7;9]

Because 
0th of A is considered as 0,
1st of A is 7,
2nd of A is 9.
I tried to use accumarray but this function is quite hard to understand and I don't know how to apply this.

A:

"0th of A is considered as 0"

No, in MatLab it's not. Indices are always positive integer. Hence you need to translate A to add one more column for 0 and increment B for proper index values. 
A = [7;9];
B = [0;0;1;1;2];

A = [0;A];
A(B+1)

Output
ans =

   0
   0
   7
   7
   9

