help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Repeated fields in printf


From: Mike B.
Subject: Re: Repeated fields in printf
Date: Thu, 26 Aug 2010 23:58:33 -0700 (PDT)

Thanks, Soren.
Mike.

--- On Fri, 27/8/10, Søren Hauberg <address@hidden> wrote:

> From: Søren Hauberg <address@hidden>
> Subject: Re: Repeated fields in printf
> To: address@hidden
> Cc: "Octave mai. lis." <address@hidden>
> Date: Friday, 27 August, 2010, 4:08 PM
> tor, 26 08 2010 kl. 18:57 -0700,
> skrev Mike B.:
> > When using printf/sprintf/fprintf is it possible to
> specifiy a field is repeated, for example something like:
> > 
> > printf( "3*%3d", 100*rand( 1, 3 ) )
> > 
> > would use three fields each of type %03d. this is
> instead of 
> > 
> > printf( "%3d %3d %3d", 100*rand( 1, 3 ) )
> 
> I don't think so, but you can use 'repmat':
> 
>   printf (repmat ("%d ", 1, 3), 100*rand (1, 3))
> 
> In this specific case, you can also just do
> 
>   printf ("%d ", 100*rand (1, 3))
> 
> Søren
> 
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]