On Monday, March 24, 2014 09:55:32 PM Jameson Nash wrote:
> tt = t( ["" for i = 1:120]... )

You can also define an inner constructor and leave many/all of the fields 
uninitialized.

--Tim

> 
> On Mon, Mar 24, 2014 at 9:43 PM, J Luis <jmfl...@gmail.com> 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