Hi
I guess what I'm trying to say is that if array "a" started life as 
[11,12,13,14] -  then if we use "filter(x->x<3, z)" which returns 1,2 - I 
would like 1,2 added to array a resulting in "a array" being ..... 
[11,12,13,14,1,2] or [1,2,11,12,13,14]
Regards

On Wednesday, March 18, 2015 at 3:05:54 PM UTC, René Donner wrote:

> I am not sure what you mean - are you expecting a different behavior than 
> this? Both z and a are containing what they should.
>
> julia> z = [1,2,3,4]
> 4-element Array{Int64,1}:
>  1
>  2
>  3
>  4
>
> julia> a = filter(x->x<3, z)
> 2-element Array{Int64,1}:
>  1
>  2
>
> julia> z
> 4-element Array{Int64,1}:
>  1
>  2
>  3
>  4
>
> julia> a
> 2-element Array{Int64,1}:
>  1
>  2
>
>
> Am Mittwoch, 18. März 2015 16:01:11 UTC+1 schrieb [email protected]:
>>
>> One thing I forgot to ask is .... what if I wan to keep the array as it 
>> is and then add to it  ...if I run a = filter(x->x<3, z) ... it overwrites 
>> the array.
>> Regards
>>
>> On Wednesday, 18 March 2015 14:04:45 UTC, [email protected] wrote:
>>>
>>> Thanks everybody - got it!
>>> Regards
>>>
>>> On Wednesday, 18 March 2015 12:04:48 UTC, René Donner wrote:
>>>>
>>>> or simply 
>>>>
>>>>   a = filter(x->x<3, z)
>>>>
>>>> Am Mittwoch, 18. März 2015 12:46:52 UTC+1 schrieb Konstantin Markov:
>>>>>
>>>>> julia> a = [i for i=filter(x->x<3,z)]
>>>>> 2-element Array{Any,1}:
>>>>>  1
>>>>>  2
>>>>>
>>>>>
>>>>> On Wednesday, March 18, 2015 at 8:31:57 PM UTC+9, [email protected] 
>>>>> wrote:
>>>>>>
>>>>>> Hi
>>>>>> I want to fill an array based on a condition - eg
>>>>>>
>>>>>> a = []
>>>>>> z = [1,2,3,4]
>>>>>>
>>>>>> for i = 1:length(z)
>>>>>> if i > 2               
>>>>>> continue
>>>>>> end
>>>>>> end
>>>>>>
>>>>>> so, I would now like to see the values 1 & 2 in  my array "a"
>>>>>> Regards
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>

Reply via email to