I am curious to see if there is a better way to what I am attempting below, in as few lines as possible. I have a column vector with the stimulus times ranging from 0 to 120,000 milliseconds. I would like to divide this vector up into 10,000 millisecond tranches, either in a new vector, a field in a structure, etc. So these tranches would be all the values 0-9,999ms, 10,000-20,0000, all the way to 120,000. My current code (shown below) is long and pretty crude and I'm sure there are quicker, more reliable, and more elegant ways to do this.
if target_times(i)< 10000
elseif (target_times(i) < 20000) && (target_times(i) >= 10000)
elseif (target_times(i) < 30000) && (target_times(i) >= 20000)
elseif (target_times(i) < 120000) && (target_times(i) >= 110000)
So if anyone has a good idea about how to separate all the values based on what 10,000 ms range they fall in, without having to predefine 12 blank arrays and write 12 different elif statements, I would appreciate it!