Thanks a lot

It would be nice to have a kind of repository for tricks where this one 
would deserve a place

Terça-feira, 25 de Março de 2014 1:55:32 UTC, Jameson escreveu:
>
> tt = t( ["" for i = 1:120]... ) 
>
> On Mon, Mar 24, 2014 at 9:43 PM, J Luis <jmf...@gmail.com <javascript:>> 
> wrote: 
> > Let's say I have this composite type 
> > 
> > julia> type t 
> >        aa::ASCIIString; 
> >        bb::ASCIIString; 
> >        end 
> > 
> > and try to fill it a la C (or Matlab) 
> > 
> > julia> tt=t 
> > t (constructor with 1 method) 
> > 
> > julia> tt.aa="AA" 
> > ERROR: type DataType has no field aa 
> > 
> > so bad surprise. I can't. So I have to do for instance 
> > 
> > julia> tt=t("AA","BB"); 
> > 
> > but my real type is 120 members long and I don't want to do it that way 
> (I 
> > would for sure make lots of mistakes). So I want to try like this 
> > 
> > julia> tt=t("",""); 
> > 
> > julia> tt.aa="AA" 
> > "AA" 
> > 
> > 
> > but do I avoid doing tt=t("","","",... 120 times?) 
> > 
> > Tried this but no luck either 
> > 
> > julia> tt=t(repmat([""],10)); 
> > ERROR: no method t(Array{ASCIIString,1}) 
> > 
> > Thanks 
> > 
> > 
> > 
> > 
>

Reply via email to