On Tue, Aug 30, 2016 at 3:39 PM, Kristoffer Carlsson <kcarlsso...@gmail.com> wrote:
> t = () > condition = true > for i = 1:N > if condition==true > t = (t..., i) > Note that you shouldn't do this unless you only have very few elements. > end > end > > > This does not modify the tuple but replaces it with a new longer one. > > On Tuesday, August 30, 2016 at 7:26:29 AM UTC+2, Alexei Serdiuk wrote: >> >> Hi, >> >> I need to choose items from a range (1:N) according to some condition and >> to push them into a tuple. >> >> I understand how to add items into an array: >> t=Array() >> for i = 1:N >> if condition==true >> push!(t, i) >> end; end >> >> Is there a way to push them into a tuple? >> >> Thanks. >> >