- #1
- 603
- 6
Homework Statement
Given variable b that contains a row vector of length 10, assign the contents of the odd indeces in b to variable odd , and assign the contents of the even indeces of b to variable even.
Examples:
Input b = [8 -3 0 7 -6 -3 1 8 7 -2]
Output odd = [8 0 -6 1 7]
even =[-3 7 -3 8 -2]
Homework Equations
The Attempt at a Solution
b is some arbitrary matrix
O = mod(b,2);
odd = b(O)
E = ~mod(b,2);
even = b(E)
What's weird is that it works for b(E) but b(O) yields and error: Subscript indices must either be real positive integers or logicals.