MATLAB: Indexing complex numbers

complex arrayindexingMATLAB

hi,
I'm trying to index the arrays of as explained below.
a = [-1+i 1+i 1+i 1+i -1+i -1-i -1+i 1+i 1-i -1+i -1-i -1+i -1-i -1-i -1+i -1-i]
b = [00 01 11 10]
-1+1 will be replaced by 00
1+i will be replaced by 01
1-i will be replaced by 11
-1-i will be replaced by 10
the problem is that, any method of indexing i try gives me the same error message saying "Subscript indices must either be real positive integers or logicals." Pls i dnt knw wat to do.
Thanks in advance

Best Answer

x = ( 1 + real(a) ) / 2;
y = ( 1 - imag(a) ) / 2;
b = [ y ; x ];