I think this is the shortest (and my favorite) way:

w = ["col$i" for i = 1:100_000]

- Dahua

On Wednesday, January 1, 2014 9:22:12 AM UTC-6, John Myles White wrote:
>
> Since we’re throwing out ways to do this, here’s another one: 
>
> w = Array(UTF8String, 100_000) 
>
> for i in 1:100_000 
>     w[i] = @sprintf "col%d" i 
> end 
>
> I’ve come to really love using the *printf macros for anything that even 
> vaguely resembles formatting. 
>
>  — John 
>
> On Jan 1, 2014, at 6:27 AM, [email protected] <javascript:> wrote: 
>
> > Hi, 
> > 
> > First of all you initialize "w" as Float64 which you do not probably 
> want. 
> > 
> > For creating vector of strings you colud write: 
> > 
> > w = ["col" * string(i) for i in 1:100000] 
> > 
> > or: 
> > 
> > w = Array(ASCIIString, 100000) 
> > 
> > for i = 1:100000 
> >   w [i] = "col" * string(i) 
> > end 
> > 
> > Bogumil 
> > 
> > On Wednesday, January 1, 2014 11:07:06 AM UTC+1, paul analyst wrote: 
> > I need a vector of string of subtitles: col1, col2, col3, ..., col100000 
> > How to join "col" phrase with numbers of  var(i) ( in the loop) 
> > 
> > w = zeros (100000); 
> > 
> > for i = 1:100000 
> > w [i] =??? 
> > end 
> > 
> > Paul 
>
>

Reply via email to