[Scilab-users] Basic query - mprintf

Samuel Gougeon samuel.gougeon at sfr.fr
Sat Jan 14 16:12:06 CET 2023


[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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20230114/13b7e4e6/attachment.htm>


More information about the users mailing list