In Matlab, you can assign a value to multiple slices of the same list:
>> a = 1:10
a =
1 2 3 4 5 6 7 8 9 10
>> a([1:3,7:9]) = 10
a =
10 10 10 4 5 6 10 10 10 10
How can you do this in Python with a numpy array?
>>> a = np.arange(10)
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> a[1:3,7:9] = 10
IndexError: too many indices
that should work I think ... I dont know that its quite what you want though
You might also consider using
np.r_
:http://docs.scipy.org/doc/numpy/reference/generated/numpy.r_.html
From http://docs.scipy.org/doc/numpy/user/basics.indexing.html (Section "Index Arrays"). Note that indices for desired slices should be contained within 'np.array()'.