1 Dec 01:25 2011

### Re: Hansl Help

Dear Sven, Allin and Jack,

Definitely you rock! Thank you so much for your help!

Just one note: Jack's suggestion didn't work in the case
the series starts with 1-block. But fortunately this is not
my case :)

X=(0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1)
Found 2 blocks, average length 8

Y=(1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,)
Found 1 block, average length 16

Best regards,
Henrique

2011/11/30 Allin Cottrell
On Wed, 30 Nov 2011, Riccardo (Jack) Lucchetti wrote:

> On Wed, 30 Nov 2011, Sven Schreiber wrote:
>
>> On 11/30/2011 10:55 PM, Henrique Andrade wrote:
>>> Dear Hansl experts,
>>>
>>> I would like to write a Hansl code but unfortunately I'm out of
>>> creativity :(
>>> I have a binary series with blocks of 0 and 1. Something like
>>>
>>> X=(0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1).
>>>
>>> Here are the steps I need do follow:
>>>
>>> (1) Find the number of 1-blocks;
>>> (2) Calculate the average number of observations inside these blocks.
>>>
>>> In my hypothetical example, the X series, I have two blocks, and these
>>> blocks have an average of 8 observations (five observations in the first
>>> block and eleven observations in the second block).
>>>
>>
>> Just a quick thought: you could take the (serial/first) difference of
>> your series and count the occurrences of -1, which indicates how many
>> times you have a 01 pattern. And each 1 in the difference indicates the
>> position of a 10 pattern (or vice versa, depending on whether you take
>> left-to-right or right-to-left differences). The position indices help
>> you determine how many ones you have in between, i.e. in each block.
>>
>> But your problem in general does look like unpleasant details to code.
>
> Building on Sven's idea: call your binary series y. Then,
>
> <hansl>
>  series chg = diff(y)
>  chg[1] = (y[1] == 1)
>  scalar n_blocks = sum(chg==1)
>  scalar avg_len = sum(y) / n_blocks
> </hansl>
>
> I think this ought to work.

Here's another approach -- not so elegant in that it involves a
loop, but it prepares a vector of block lengths, in case that might
be wanted.

<hansl>
matrix X={0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1}'
matrix B = {}
scalar blen = 0
scalar n = rows(X)

loop i=1..n -q
if X[i] == 1
blen++
if i == n || X[i+1] == 0
B |= {blen}
blen = 0
endif
endif
endloop

printf "Found %d blocks, average length %g\n",
rows(B), meanc(B)
</hansl>

Allin Cottrell
_______________________________________________
Gretl-users mailing list
Gretl-users-npDYnXcwJHngpn9g0Uvcdg@public.gmane.org
http://lists.wfu.edu/mailman/listinfo/gretl-users

--

```<div>
<p>Dear Sven, Allin and Jack,</p>
<div><br></div>
<div>Definitely you rock! Thank you so much for your help!<br><br>
</div>
<div>
<div>Just one note: Jack's suggestion didn't work in the case</div>
<div>the series starts&nbsp;with 1-block. But fortunately this is not</div>

<div>my case :)</div>
<div><br></div>
<div>X=(0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1)</div>
<div>Found 2 blocks, average length 8</div>
<div><br></div>
<div>Y=(1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,)</div>
<div>

Found 1 block, average length 16</div>
</div>
<div><br></div>
<div>Best regards,</div>
<div>Henrique</div>
<div><br></div>
<div>
<br><div class="gmail_quote">2011/11/30 Allin Cottrell <span dir="ltr">&lt;<a href="mailto:cottrell@...">cottrell@...</a>&gt;</span><br><blockquote class="gmail_quote">
<div class="HOEnZb"><div class="h5">On Wed, 30 Nov 2011, Riccardo (Jack) Lucchetti wrote:<br><br>
&gt; On Wed, 30 Nov 2011, Sven Schreiber wrote:<br>
&gt;<br>
&gt;&gt; On 11/30/2011 10:55 PM, Henrique Andrade wrote:<br>
&gt;&gt;&gt; Dear Hansl experts,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I would like to write a Hansl code but unfortunately I'm out of<br>
&gt;&gt;&gt; creativity :(<br>
&gt;&gt;&gt; I have a binary series with blocks of 0 and 1. Something like<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; X=(0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1).<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Here are the steps I need do follow:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; (1) Find the number of 1-blocks;<br>
&gt;&gt;&gt; (2) Calculate the average number of observations inside these blocks.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; In my hypothetical example, the X series, I have two blocks, and these<br>
&gt;&gt;&gt; blocks have an average of 8 observations (five observations in the first<br>
&gt;&gt;&gt; block and eleven observations in the second block).<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Just a quick thought: you could take the (serial/first) difference of<br>
&gt;&gt; your series and count the occurrences of -1, which indicates how many<br>
&gt;&gt; times you have a 01 pattern. And each 1 in the difference indicates the<br>
&gt;&gt; position of a 10 pattern (or vice versa, depending on whether you take<br>
&gt;&gt; left-to-right or right-to-left differences). The position indices help<br>
&gt;&gt; you determine how many ones you have in between, i.e. in each block.<br>
&gt;&gt;<br>
&gt;&gt; But your problem in general does look like unpleasant details to code.<br>
&gt;<br>
&gt; Building on Sven's idea: call your binary series y. Then,<br>
&gt;<br>
&gt; &lt;hansl&gt;<br>
&gt; &nbsp;series chg = diff(y)<br>
&gt; &nbsp;chg[1] = (y[1] == 1)<br>
&gt; &nbsp;scalar n_blocks = sum(chg==1)<br>
&gt; &nbsp;scalar avg_len = sum(y) / n_blocks<br>
&gt; &lt;/hansl&gt;<br>
&gt;<br>
&gt; I think this ought to work.<br><br>
</div></div>Here's another approach -- not so elegant in that it involves a<br>
loop, but it prepares a vector of block lengths, in case that might<br>
be wanted.<br><br>
&lt;hansl&gt;<br>
matrix X={0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1}'<br>
matrix B = {}<br>
scalar blen = 0<br>
scalar n = rows(X)<br><br>
loop i=1..n -q<br>
&nbsp; if X[i] == 1<br>
&nbsp; &nbsp; blen++<br>
&nbsp; &nbsp; if i == n || X[i+1] == 0<br>
&nbsp; &nbsp; &nbsp; B |= {blen}<br>
&nbsp; &nbsp; &nbsp; blen = 0<br>
&nbsp; &nbsp; endif<br>
&nbsp; endif<br>
endloop<br><br>
printf "Found %d blocks, average length %g\n",<br>
&nbsp; rows(B), meanc(B)<br>
&lt;/hansl&gt;<br><span class="HOEnZb"><br>
Allin Cottrell<br></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Gretl-users mailing list<br><a href="mailto:Gretl-users@...">Gretl-users@...</a><br><a href="http://lists.wfu.edu/mailman/listinfo/gretl-users" target="_blank">http://lists.wfu.edu/mailman/listinfo/gretl-users</a><br>
</div></div>
</blockquote>
</div>
</div>
</div>
```
5 Dec 11:49 2011

### Request: Matrix-plot feature

Hello gretl users and programmers,

I would like to request a feature for plotting matrices -- of course only if it would not be too difficult to implement and makes some sense to you
Until now one has to define each column which one wants to plot. Could it be possible to make an option available like

----------------
gnuplot 1..5 ---with-lines --time-series --matrix=X
----------------

to make it easier to plot several columns in a sequence (1 to 5) at once?

I ask for this since i've got to generate some figures via a loop command and the underlying matrices have different dimensions:

----------------
loop for i=1..models --quiet
TR_fw_\$i <- gnuplot 1..k --with-lines --time-series --matrix=trace_fw_\$i
endloop
----------------

Maybe somebody has another simple solution for this?

Best,
Artur

```<div><p>Hello gretl users and programmers,<br><br>I would like to request a feature for plotting matrices -- of course only if it would not be too difficult to implement and makes some sense to you <br>Until now one has to define each column which one wants to plot. Could it be possible to make an option available like<br><br>----------------<br>gnuplot 1..5 ---with-lines --time-series --matrix=X<br>----------------<br><br>to make it easier to plot several columns in a sequence (1 to 5) at once? <br><br>I ask for this since i've got to generate some figures via a loop command and the underlying matrices have different dimensions:<br><br>----------------<br>loop for i=1..models --quiet<br>&nbsp;&nbsp;&nbsp; TR_fw_\$i &lt;- gnuplot 1..k --with-lines --time-series --matrix=trace_fw_\$i<br>endloop<br>----------------<br><br>Maybe somebody has another simple solution for this?<br><br>Best,<br>Artur<br></p></div>
```
5 Dec 12:01 2011

### Re: Request: Matrix-plot feature

```On 12/05/2011 11:49 AM, artur tarassow wrote:
> Hello gretl users and programmers,
>
> I would like to request a feature for plotting matrices -- of course
> only if it would not be too difficult to implement and makes some sense
> to you
> Until now one has to define each column which one wants to plot. Could
> it be possible to make an option available like
>
> ----------------
> gnuplot 1..5 ---with-lines --time-series --matrix=X
> ----------------
>
> to make it easier to plot several columns in a sequence (1 to 5) at once?
>
> I ask for this since i've got to generate some figures via a loop
> command and the underlying matrices have different dimensions:
>
> ----------------
> loop for i=1..models --quiet
>     TR_fw_\$i <- gnuplot 1..k --with-lines --time-series --matrix=trace_fw_\$i
> endloop
> ----------------
>
> Maybe somebody has another simple solution for this?
>

Write the column indices into a string and insert the string in your
gnuplot command. Something like (totally untested):

sprintf strColindices "%d", seq(1,cols(mymatrix))
gnuplot  <at> strColindices --with-lines <etc>

hth,
sven

```
5 Dec 12:30 2011

### Re: Request: Matrix-plot feature

But unfortunately this does not work properly, since the string printed looks like
-------
1234
-------
but gnuplot needs for seperating the columns a space between the numbers:
----------
1 2 3 4
----------

Best,
Artur

2011/12/5 Sven Schreiber
On 12/05/2011 11:49 AM, artur tarassow wrote:
> Hello gretl users and programmers,
>
> I would like to request a feature for plotting matrices -- of course
> only if it would not be too difficult to implement and makes some sense
> to you
> Until now one has to define each column which one wants to plot. Could
> it be possible to make an option available like
>
> ----------------
> gnuplot 1..5 ---with-lines --time-series --matrix=X
> ----------------
>
> to make it easier to plot several columns in a sequence (1 to 5) at once?
>
> I ask for this since i've got to generate some figures via a loop
> command and the underlying matrices have different dimensions:
>
> ----------------
> loop for i=1..models --quiet
>     TR_fw_\$i <- gnuplot 1..k --with-lines --time-series --matrix=trace_fw_\$i
> endloop
> ----------------
>
> Maybe somebody has another simple solution for this?
>

Write the column indices into a string and insert the string in your
gnuplot command. Something like (totally untested):

sprintf strColindices "%d", seq(1,cols(mymatrix))
gnuplot <at> strColindices --with-lines <etc>

hth,
sven

_______________________________________________
Gretl-users mailing list
Gretl-users-npDYnXcwJHngpn9g0Uvcdg@public.gmane.org
http://lists.wfu.edu/mailman/listinfo/gretl-users

```<div>
<p>Nice idea, sven. Thank you for your reply.<br><br>But unfortunately this does not work properly, since the string printed looks like <br>-------<br>1234<br>-------<br>but gnuplot needs for seperating the columns a space between the numbers:<br>
----------<br>1 2 3 4<br>----------<br><br>Best,<br>Artur<br><br></p>
<div class="gmail_quote">2011/12/5 Sven Schreiber <span dir="ltr">&lt;<a href="mailto:svetosch@...">svetosch@...</a>&gt;</span><br><blockquote class="gmail_quote">
<div class="HOEnZb"><div class="h5">On 12/05/2011 11:49 AM, artur tarassow wrote:<br>
&gt; Hello gretl users and programmers,<br>
&gt;<br>
&gt; I would like to request a feature for plotting matrices -- of course<br>
&gt; only if it would not be too difficult to implement and makes some sense<br>
&gt; to you <br>
&gt; Until now one has to define each column which one wants to plot. Could<br>
&gt; it be possible to make an option available like<br>
&gt;<br>
&gt; ----------------<br>
&gt; gnuplot 1..5 ---with-lines --time-series --matrix=X<br>
&gt; ----------------<br>
&gt;<br>
&gt; to make it easier to plot several columns in a sequence (1 to 5) at once?<br>
&gt;<br>
&gt; I ask for this since i've got to generate some figures via a loop<br>
&gt; command and the underlying matrices have different dimensions:<br>
&gt;<br>
&gt; ----------------<br>
&gt; loop for i=1..models --quiet<br>
&gt; &nbsp; &nbsp; TR_fw_\$i &lt;- gnuplot 1..k --with-lines --time-series --matrix=trace_fw_\$i<br>
&gt; endloop<br>
&gt; ----------------<br>
&gt;<br>
&gt; Maybe somebody has another simple solution for this?<br>
&gt;<br><br>
</div></div>Write the column indices into a string and insert the string in your<br>
gnuplot command. Something like (totally untested):<br><br>
sprintf strColindices "%d", seq(1,cols(mymatrix))<br>
gnuplot  <at> strColindices --with-lines &lt;etc&gt;<br><br>
hth,<br>
sven<br><br>
_______________________________________________<br>
Gretl-users mailing list<br><a href="mailto:Gretl-users@...">Gretl-users@...</a><br><a href="http://lists.wfu.edu/mailman/listinfo/gretl-users" target="_blank">http://lists.wfu.edu/mailman/listinfo/gretl-users</a><br>
</blockquote>
</div>
<br>
</div>
```
5 Dec 12:32 2011

### Re: Request: Matrix-plot feature

```On Mon, 5 Dec 2011, Sven Schreiber wrote:

> Write the column indices into a string and insert the string in your
> gnuplot command. Something like (totally untested):
>
> sprintf strColindices "%d", seq(1,cols(mymatrix))
> gnuplot  <at> strColindices --with-lines <etc>

In other words:

<hansl>
T = 20
matrix x_1 = mnormal(T, 3)
matrix x_2 = mnormal(T, 2)
matrix x_3 = mnormal(T, 6)

loop i=1..3 --quiet
colsel = ""
c = cols(x_\$i)
loop j=1..c --quiet
sprintf colsel "%s \$j", colsel
end loop

gnuplot  <at> colsel --matrix=x_\$i --output=display
end loop
</hansl>

Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti@...
http://www.econ.univpm.it/lucchetti```
```On Mon, 5 Dec 2011, Sven Schreiber wrote:

> Write the column indices into a string and insert the string in your
> gnuplot command. Something like (totally untested):
>
> sprintf strColindices "%d", seq(1,cols(mymatrix))
> gnuplot  <at> strColindices --with-lines <etc>

In other words:

<hansl>
T = 20
matrix x_1 = mnormal(T, 3)
matrix x_2 = mnormal(T, 2)
matrix x_3 = mnormal(T, 6)

loop i=1..3 --quiet
colsel = ""
c = cols(x_\$i)
loop j=1..c --quiet
sprintf colsel "%s \$j", colsel
end loop

gnuplot  <at> colsel --matrix=x_\$i --output=display
end loop
</hansl>

Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti@...
http://www.econ.univpm.it/lucchetti```
5 Dec 12:45 2011

### Re: Request: Matrix-plot feature

```On Mon, 5 Dec 2011, Sven Schreiber wrote:

> sprintf strColindices "%d", seq(1,cols(mymatrix))
> gnuplot  <at> strColindices --with-lines <etc>

A technical note to Sven's idea: the problem is not the space (or lack
thereof): a print format like "%3d" would have solved the problem; the
problem is that when you "printf" a matrix, a newline is automtically
appended, which confuses the gnuplot command.

Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti@...
http://www.econ.univpm.it/lucchetti```
```On Mon, 5 Dec 2011, Sven Schreiber wrote:

> sprintf strColindices "%d", seq(1,cols(mymatrix))
> gnuplot  <at> strColindices --with-lines <etc>

A technical note to Sven's idea: the problem is not the space (or lack
thereof): a print format like "%3d" would have solved the problem; the
problem is that when you "printf" a matrix, a newline is automtically
appended, which confuses the gnuplot command.

Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti@...
http://www.econ.univpm.it/lucchetti```
5 Dec 15:05 2011

### Re: Request: Matrix-plot feature

Thank you both Sven and Riccardo for your help.
I did now in this way, and it works fine.

----------------------------------------------
loop i=1..models --quiet
colind = ""
k = nelem(mod\$i)
loop j=1..k #--quiet
sprintf colind "%s \$j", colind
end loop
TR_fw_\$i <- gnuplot <at> colind --with-lines --time-series --matrix=trace_fw_\$i
end loop
----------------------------------------------

Best,
Artur

2011/12/5 Riccardo (Jack) Lucchetti
On Mon, 5 Dec 2011, Sven Schreiber wrote:

sprintf strColindices "%d", seq(1,cols(mymatrix))
gnuplot <at> strColindices --with-lines <etc>

A technical note to Sven's idea: the problem is not the space (or lack thereof): a print format like "%3d" would have solved the problem; the problem is that when you "printf" a matrix, a newline is automtically appended, which confuses the gnuplot command.

Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti <at> univpm.it
http://www.econ.univpm.it/lucchetti

_______________________________________________
Gretl-users mailing list
Gretl-users-npDYnXcwJHngpn9g0Uvcdg@public.gmane.org
http://lists.wfu.edu/mailman/listinfo/gretl-users

```<div>
<p>Thank you both Sven and Riccardo for your help.<br>I did now in this way, and it works fine.<br><br>----------------------------------------------<br>loop i=1..models --quiet<br>&nbsp;&nbsp; colind = ""<br>&nbsp;&nbsp; k = nelem(mod\$i)&nbsp;&nbsp; <br>
&nbsp;&nbsp; loop j=1..k #--quiet<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sprintf colind "%s \$j", colind<br>&nbsp;&nbsp; end loop<br>&nbsp;&nbsp; TR_fw_\$i &lt;- gnuplot  <at> colind --with-lines --time-series --matrix=trace_fw_\$i <br>end loop<br>----------------------------------------------<br><br>Best,<br>Artur<br><br></p>
<div class="gmail_quote">2011/12/5 Riccardo (Jack) Lucchetti <span dir="ltr">&lt;<a href="mailto:r.lucchetti@...">r.lucchetti@...</a>&gt;</span><br><blockquote class="gmail_quote">
<div class="im">On Mon, 5 Dec 2011, Sven Schreiber wrote:<br><br>
</div>
<div class="im">
<blockquote class="gmail_quote">
sprintf strColindices "%d", seq(1,cols(mymatrix))<br>
gnuplot  <at> strColindices --with-lines &lt;etc&gt;<br>
</blockquote>
<br>
</div>
A technical note to Sven's idea: the problem is not the space (or lack thereof): a print format like "%3d" would have solved the problem; the problem is that when you "printf" a matrix, a newline is automtically appended, which confuses the gnuplot command.<div class="HOEnZb">
<div class="h5">
<br><br>
Riccardo (Jack) Lucchetti<br>
Dipartimento di Economia<br>
Universit&agrave; Politecnica delle Marche<br><br><a href="mailto:r.lucchetti@..." target="_blank">r.lucchetti <at> univpm.it</a><br><a href="http://www.econ.univpm.it/lucchetti" target="_blank">http://www.econ.univpm.it/lucchetti</a>
</div>
</div>
<br>_______________________________________________<br>
Gretl-users mailing list<br><a href="mailto:Gretl-users@...">Gretl-users@...</a><br><a href="http://lists.wfu.edu/mailman/listinfo/gretl-users" target="_blank">http://lists.wfu.edu/mailman/listinfo/gretl-users</a><br>
</blockquote>
</div>
<br>
</div>
```
5 Dec 16:34 2011

### Re: Request: Matrix-plot feature

```On Mon, 5 Dec 2011, artur tarassow wrote:

> Thank you both Sven and Riccardo for your help.
> I did now in this way, and it works fine.
>
> ----------------------------------------------
> loop i=1..models --quiet
>   colind = ""
>   k = nelem(mod\$i)
>   loop j=1..k #--quiet
>       sprintf colind "%s \$j", colind
>   end loop
>   TR_fw_\$i <- gnuplot  <at> colind --with-lines --time-series
> --matrix=trace_fw_\$i
> end loop
> ----------------------------------------------

This may not be directly relevant to the task you describe,
but it's not too far distant: in CVS and snapshots, the
"yvars" and "xvar" arguments to the gnuplot command can now be
left implicit when a matrix is specified via the --matrix
option.

If --time-series is given the default is to plot all columns
of the matrix against time, otherwise the last column of the
matrix is taken as "xvar" and the others as "yvars".

Of course, you can still specify the columns to plot if you
wish.

Allin Cottrell

```
5 Dec 17:31 2011

### Re: Request: Matrix-plot feature

```On Mon, 5 Dec 2011, Allin Cottrell wrote:

> This may not be directly relevant to the task you describe, but it's not too
> far distant: in CVS and snapshots, the "yvars" and "xvar" arguments to the
> gnuplot command can now be left implicit when a matrix is specified via the
> --matrix option.

for example, if you want to see an nice bunch of random walks:

<hansl>
X = cum(mnormal(40,3)) ~ seq(1,40)'
gnuplot --matrix=X --output=display --with-lines
</hansl>

>
> If --time-series is given the default is to plot all columns of the matrix
> against time, otherwise the last column of the matrix is taken as "xvar" and
> the others as "yvars".

or

<hansl>
X = cum(mnormal(40,3))
gnuplot --matrix=X --output=display --with-lines --time-series
</hansl>

Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti@...
http://www.econ.univpm.it/lucchetti```
```On Mon, 5 Dec 2011, Allin Cottrell wrote:

> This may not be directly relevant to the task you describe, but it's not too
> far distant: in CVS and snapshots, the "yvars" and "xvar" arguments to the
> gnuplot command can now be left implicit when a matrix is specified via the
> --matrix option.

for example, if you want to see an nice bunch of random walks:

<hansl>
X = cum(mnormal(40,3)) ~ seq(1,40)'
gnuplot --matrix=X --output=display --with-lines
</hansl>

>
> If --time-series is given the default is to plot all columns of the matrix
> against time, otherwise the last column of the matrix is taken as "xvar" and
> the others as "yvars".

or

<hansl>
X = cum(mnormal(40,3))
gnuplot --matrix=X --output=display --with-lines --time-series
</hansl>

Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti@...
http://www.econ.univpm.it/lucchetti```
5 Dec 19:19 2011

### Re: Request: Matrix-plot feature

```On 12/05/2011 12:45 PM, Riccardo (Jack) Lucchetti wrote:
> On Mon, 5 Dec 2011, Sven Schreiber wrote:
>
>> sprintf strColindices "%d", seq(1,cols(mymatrix))
>> gnuplot  <at> strColindices --with-lines <etc>
>
> A technical note to Sven's idea: the problem is not the space (or lack
> thereof): a print format like "%3d" would have solved the problem; the
> problem is that when you "printf" a matrix, a newline is automtically
> appended, which confuses the gnuplot command.
>

Hm, I see. I seem to remember a special backspace character \b -- would
it work to add that to the string, in the hope of deleting the appended
newline character \n?

Alternatively, would it work to process strColindices further with:
strsub(strColindices,"\n","")
?

(BTW: I don't understand the help text for strsplit().)

Thanks,
Sven

```

Gmane