Try this:
[maxValue, indexOfMax] = max(signal);
index1 = max([1, indexOfMax - 5000]); % Don't allow less than 1.
index2 = min([indexOfMax + 5000, length(signal)]); % Don't allow more than the length of your signal.
output = signal(index1 : index2); % Extract
If you have clipping because one index is outside the range, and you still need 10,000 elements, then you can take a few more steps to ensure that.