[Scilab-users] Basic query - mprintf

Lester Anderson arctica1963 at gmail.com
Thu Apr 7 12:09:58 CEST 2022


Thanks all for the solution!

Cheers
Lester

On Thu, 7 Apr 2022 at 11:02, Stefan Du Rietz <sdr at durietz.se> wrote:

> Of course you don't need to make the string s.
>
> You have to transpose fac to get a column vector for mprintf and then
> transpose the column string vector to get a row string vector:
>
> --> fac = msprintf("%d\n", fac')'
>   fac  =
>    "7"  "13"  "19"
>
> and then concatenate the string so that it works for a variable number
> of elements in fac:
>
> --> mprintf("Factors of 1729 are:  %s", strcat(fac,"  "))
>
> Stefan
>
>
> On 2022-04-07 11:30, Stefan Du Rietz wrote:
> > Hello Lester,
> >
> > --> s = msprintf("Factors of 1729 are:  ");
> >   s  =
> >    "Factors of 1729 are:  "
> > --> fac = msprintf("%d\n", fac')'
> >   fac  =
> >    "7"  "13"  "19"
> > --> mprintf("%s%s", s, strcat(fac, "  "))
> > Factors of 1729 are:  7  13  19
> >
> > Regards
> > Stefan
> >
> >
> > On 2022-04-07 09:50, Lester Anderson wrote:
> >> Hello all,
> >>
> >> Very basic query but how do you print all the values from a result via
> >> mprintf?
> >>
> >> e.g.
> >>
> >> fac = factor(1729)
> >> 7 13 19
> >>
> >> mprintf('Factors of 1729 are: %d\n', fac)
> >> just prints 'Factors of 1729 are: 7
> >>
> >> Sorry for the basic question!
> >> Cheers
> >> Lester
> >>
> >> _______________________________________________
> >> users mailing list
> >> users at lists.scilab.org
> >> http://lists.scilab.org/mailman/listinfo/users
> > _______________________________________________
> > users mailing list
> > users at lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20220407/38ca4206/attachment.htm>


More information about the users mailing list