There are a number of different ways, depending upon how large your array is. The simplest approach is to just concatenate the values into the new array. For example:
new_x = []
for i=0,n_elements(x)-1 do begin
if x[i] "matches condition" then new_x = [new_x, x[i]]
endfor
This will work fine for small arrays but becomes very expensive and slow for large arrays, since you are always re-allocating the memory.
A better approach is to use a "flag" array, then use "WHERE" to extract the indices. For example:
flag = BYTARR(N_ELEMENTS(x))
for i=0,n_elements(x)-1 do begin
if x[i] "matches condition" then flag[i] = 1
endfor
new_x = x[WHERE(flag, /NULL)]
The best way would be to eliminate the for loop completely, but this may not be possible. For example, let's say you just wanted X values that were within a certain data range:
new_x = x[WHERE(x ge 5 and x le 10, /NULL)]
Hopefully one of these methods will work for your problem.