Re: [Scilab-users] Basic query - mprintf

2023-01-14 Thread Samuel Gougeon
[Let's try to answer without technical reply. Hope to not break or shift 
the thread]



On 2023-01-11 22:33:10, Stefan Du Rietz wrote:

Too print all elements, the argument must be a column vector: fac'
And to avoid repeating the first wording, you can print it separately:

--> mprintf("Factors of 1729 are: "), mprintf("%d  ", fac')
Factors of 1729 are: 7  13  19

Stefan

Yes, i have well read your previous answer. I was just providing an 
alternative.


That was not the initial querry, but write() allows to iterate on rows 
AND columns in the same way, adapting to free numbers of rows AND 
columns with the same unique simple syntax:


--> fac = grand(3,4,"uin",0,9)
 fac  =
   2.   5.   9.   3.
   2.   4.   5.   5.
   4.   1.   8.   5.

--> write(%io(2), fac, "(''The row is:'', 10(i2,2x))")
The row is: 2   5   9   3
The row is: 2   4   5   5
The row is: 4   1   8   5

One could dream of extending the C syntax with this Fortran feature...
The first days of January are a good for wishes :-)

Samuel___
users mailing list - users@lists.scilab.org
Click here to unsubscribe: 
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Basic query - mprintf

2023-01-11 Thread Stefan Du Rietz

On 2023-01-11 00:11, Samuel Gougeon wrote:

Le 07/04/2022 à 09:50, Lester Anderson a écrit :

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

You may also use a Fortran syntax -- that supports automatic inline 
iterations, unlike C syntaxes -- instead of a  C one:


--> fac = factor(1729);
--> write(%io(2), fac, "(''Factors of 1729 are:'', 10(i2,2x))")

Factors of 1729 are: 7  13  19

Samuel

PS : i no longer receive messages from users@ since 2022-10-05 (last 
received).
So for the time being, i answer to old threads, to not break recent ones 
to which i can't reply, just read archives.




Too print all elements, the argument must be a column vector: fac'
And to avoid repeating the first wording, you can print it separately:

--> mprintf("Factors of 1729 are: "), mprintf("%d  ", fac')
Factors of 1729 are: 7  13  19

Stefan




___
users mailing list - users@lists.scilab.org
Click here to unsubscribe: 
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Basic query - mprintf

2023-01-10 Thread Samuel Gougeon

Le 07/04/2022 à 09:50, Lester Anderson a écrit :

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

You may also use a Fortran syntax -- that supports automatic inline 
iterations, unlike C syntaxes -- instead of a  C one:


--> fac = factor(1729);
--> write(%io(2), fac, "(''Factors of 1729 are:'', 10(i2,2x))")

Factors of 1729 are: 7  13  19

Samuel

PS : i no longer receive messages from users@ since 2022-10-05 (last 
received).
So for the time being, i answer to old threads, to not break recent ones 
to which i can't reply, just read archives.


___
users mailing list - users@lists.scilab.org
Click here to unsubscribe: 
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Basic query - mprintf

2022-04-07 Thread Lester Anderson
Thanks all for the solution!

Cheers
Lester

On Thu, 7 Apr 2022 at 11:02, Stefan Du Rietz  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@lists.scilab.org
> >> http://lists.scilab.org/mailman/listinfo/users
> > ___
> > users mailing list
> > users@lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Basic query - mprintf

2022-04-07 Thread Stefan Du Rietz

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@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Basic query - mprintf

2022-04-07 Thread Stefan Du Rietz

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@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Basic query - mprintf

2022-04-07 Thread Lester Anderson
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@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users