It's working fine for me:

julia> x1 = rand(1:10,5); x2 = copy(x1)
5-element Array{Int64,1}:
 7
 4
 6
 8
 2

julia> errs = [2,4];

julia> deleteat!(x1,errs);

julia> x1
3-element Array{Int64,1}:
 7
 6
 2

julia> for i=length(errs):-1:1
         splice!(x2,errs[i])
       end

julia> x2
3-element Array{Int64,1}:
 7
 6
 2




On Monday, February 23, 2015 at 8:07:43 AM UTC-5, Aero_flux wrote:
>
> Thanks for the reply. I did try deleteat! without much success. What did 
> work for me was the following though:
>
> errors=reverse(errors) #start with the largest index first and work down
>
> for x=1:length(errors)
>   splice!(data,errors[x])
> end
>
>
>
> On Monday, February 23, 2015 at 8:17:29 AM UTC, Josh Langsfeld wrote:
>>
>> corrected_data = deleteat!(x, errors) should be what you're looking for. 
>> Alternately, a more functionally pure way to do it is to compute the good 
>> indices and then just do corrected_data = x[good_idx], though this will 
>> make a copy of those elements of x.
>>
>> On Sunday, February 22, 2015 at 3:14:11 PM UTC-5, Aero_flux wrote:
>>>
>>> Hello everybody,
>>>
>>> I might be going about this the wrong way. I have a sequence of data in 
>>> a 1-D array "x". Now I have done some calculations and have a 1-D array of 
>>> the indexed points in "x" that erroneous. What I would like to to is remove 
>>> all the data points in "x" that uses the saved indices. I figured I would 
>>> use corrected_data = splice!(x, errors) but of course it won't take arrays. 
>>> Any hints?
>>>
>>> Many thanks
>>>
>>

Reply via email to