<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le 24/02/2016 17:10, Clément David a
écrit :<br>
</div>
<blockquote
cite="mid:1456330219.3141.9.camel@scilab-enterprises.com"
type="cite">
<pre wrap="">Hi Samuel,
Le mercredi 24 février 2016 à 15:27 +0100, Samuel Gougeon a écrit :
</pre>
<blockquote type="cite">
<pre wrap="">I am pretty sure that an horizontal iterator was recently implemented for the format
used within mprintf(), but i am failing to find any information about how to use it.
</pre>
</blockquote>
<pre wrap="">
What do you mean by "horizontal iterator" ? Is it like the "argument_index$" for Java [1] ?</pre>
</blockquote>
<br>
I don't know much java, but as Fortran format allows it with
"#(...)", this one replicates at most #times the content of ()<br>
(that may have other (...) patterns (recursive
replication/substitution))... Then, for all provided data, the
format is feed with <br>
row-wise input data and builds the output with replicating the
format as many times as some input data remain <br>
(for the current row), and then stop without error (even before the
end of the format).<br>
<br>
Unfortunately, write() that could manage such a handy fortran format
is not well implemented:<br>
<ul>
<li><a href="http://bugzilla.scilab.org/3798">the write() format
cannot mix input data types (bug 3798)<br>
</a></li>
<li><a href="http://bugzilla.scilab.org/12476">when the write()
format meets a string (a), its parsing stops (bug 12476)</a></li>
</ul>
<p>Being so handicaped, write() has not much interest wrt mprintf(),
and AFAIK, there is presently <br>
no native Scilab function handling input data in this way. We are
compelled to use things <br>
like this msprintf():<br>
</p>
<p><tt>--> NL=4; NC=6; Nchar=5; </tt></p>
<p><tt>--> data =
matrix(strsplit(ascii(grand(NL*NC*Nchar,1,"uin",32,126)),(1:NL*NC-1)*Nchar),NL,NC)</tt><tt><br>
</tt><tt> data = </tt><tt><br>
</tt><tt><br>
</tt><tt>!/6QV0 L)3zw I<wxX l/u02 f(kAd #P8oI !</tt><tt><br>
</tt><tt>! !</tt><tt><br>
</tt><tt>!+`kUF !'{*` BE$d% q3WnC Ch:iP 3|fj^ !</tt><tt><br>
</tt><tt>! !</tt><tt><br>
</tt><tt>!FdBRS !Gsp" VkE<- ySYC< UNX-. Gbfb# !</tt><tt><br>
</tt><tt>! !</tt><tt><br>
</tt><tt>!xJZH3 W!(g" ~p9@z 3Df9 6CjU7 MDWnB !</tt><tt><br>
</tt><tt><br>
</tt><tt>--> <font color="#009900">mprintf(strcat(emptystr(1,size(data,2))+"%10s
")+"\n", data) </font></tt><tt><br>
</tt><tt> /6QV0 L)3zw I<wxX l/u02
f(kAd #P8oI </tt><tt><br>
</tt><tt> +`kUF !'{*` BE$d% q3WnC
Ch:iP 3|fj^ </tt><tt><br>
</tt><tt> FdBRS !Gsp" VkE<- ySYC<
UNX-. Gbfb# </tt><tt><br>
</tt><tt> xJZH3 W!(g" ~p9@z 3Df9
6CjU7 MDWnB </tt><tt><br>
</tt></p>
<p>since write() misworks:</p>
<p><tt>--> write(%io(2), data, "((2x a))")</tt><tt><br>
</tt><tt> /6QV0</tt><tt><br>
</tt><tt> +`kUF</tt><tt><br>
</tt><tt> FdBRS</tt><tt><br>
</tt><tt> xJZH3</tt><tt><br>
</tt><tt> L)3zw</tt><tt><br>
</tt><tt> !'{*`</tt><tt><br>
</tt><tt> !Gsp"</tt><tt><br>
</tt><tt> W!(g"</tt><tt><br>
</tt><tt> I<wxX</tt><tt><br>
</tt><tt> BE$d%</tt><tt><br>
</tt><tt> VkE<-</tt><tt><br>
</tt><tt> ~p9@z</tt><tt><br>
</tt><tt> l/u02</tt><tt><br>
</tt><tt> q3WnC</tt><tt><br>
</tt><tt> ySYC<</tt><tt><br>
</tt><tt> 3Df9</tt><tt><br>
</tt><tt> f(kAd</tt><tt><br>
</tt><tt> Ch:iP</tt><tt><br>
</tt><tt> UNX-.</tt><tt><br>
</tt><tt> 6CjU7</tt><tt><br>
</tt><tt> #P8oI</tt><tt><br>
</tt><tt> 3|fj^</tt><tt><br>
</tt><tt> Gbfb#</tt><tt><br>
</tt><tt> MDWnB</tt><br>
</p>
<p>Samuel<br>
</p>
</body>
</html>