Thanks Mathieu,<div><br></div><div>Your elaborate explanation is very much appreciated.</div><div><br></div><div>Best regards,</div><div><br></div><div>Peng<br><div><br><div class="gmail_quote">On 24 October 2010 21:26, Mathieu Dubois <span dir="ltr"><<a href="mailto:mathieu.dubois@limsi.fr">mathieu.dubois@limsi.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
<br>
Le 24/10/2010 22:07, Peng Du a écrit :<div class="im"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Mathieu,<br>
<br>
Yes I think you are right. So I think I need to improve the way that<br>
data is read because simply changing the stacksize won't solve the<br>
problem fundamentally.<br>
<br>
</blockquote></div>
Stack' size is a recurrent problem under Scilab (in fact it can also append in compiled language although I'm not sure that this is the same problem). The point is that your data are stored on the stack so changing the way you read data won't change the problem (of course if you use large intermediary variable you can free them but if your data are really huge you will reach the problem some day).<br>
<br>
Increasing stack' size is really the solution. It's common under Scilab (I think that version 6 will solve this). Matlab also has this. Most of my scripts start with stacksize(2000000). And if I they still not work I simply add a 0. Of course at some point you reach hardaware/OS limit but I have never faced the problem. There was a message a few month ago from someone who read so many data that Scilab wasn't allowed to allocate memory. I think that he/she split his dataset.<div class="im">
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And talking about matrix, is the effect of using a 16*n matrix the same<br>
with using 16 1*n arrays? How can I change my program so it requires<br>
smaller stacksize and probably runs faster?<br>
<br>
</blockquote></div>
I think that a n*16 matrix (16 columns) consume more or less the same amount of memory than 16 n*1 matrices (probably a bit less - a few bits less).<br>
<br>
But most Scilab function can work with matrices so it may be more convenient. In statistics it is common to put data in a m*n matrix where each column represent a variable (so there are n variables) and each line an observation (disclaimer: I'm not a statistician :)<br>
<br>
One function that is very helpful for fast I/O is mscanf. It's a bit hard to understand but once you get, it's very useful.<br>
<br>
Another function is fscanfMat.<br>
<br>
HTH,<br><font color="#888888">
Mathieu<br>
<br>
</font><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Thanks.<br>
<br>
Peng<br>
<br>
On 24 October 2010 20:58, Mathieu Dubois <<a href="mailto:mathieu.dubois@limsi.fr" target="_blank">mathieu.dubois@limsi.fr</a><br></div><div class="im">
<mailto:<a href="mailto:mathieu.dubois@limsi.fr" target="_blank">mathieu.dubois@limsi.fr</a>>> wrote:<br>
<br>
Hi Peng<br>
<br>
Le 24/10/2010 21:12, Peng Du a écrit :<br>
<br>
Hi everyone.<br>
<br>
I have a question about how to plot efficiently.<br>
<br>
My scilab program reads data from a file containing 16 columns. Each<br>
column represents the data for a polyline. So what I have been<br>
doing so<br>
far is to build 16 separate arrays and plot them in one graph.<br>
However<br>
as the size of the file grows, sometimes up to several GBs, it<br>
started<br>
to take a very long time to finish and finally I got the error<br>
message<br>
of exceeded stack size. Does anyone know how I can work around this?<br>
<br>
I don't think that problem comes from plot but rather from your data<br>
reading function.<br>
<br>
To increase the stack size, you can use stacksize (see<br>
help("stacksize")).<br>
<br>
By the way if you call plot2d with a matrix it will plot a polyline<br>
for each column on the same graph.<br>
<br>
HTH,<br>
Mathieu<br>
<br>
<br>
</div></blockquote>
</blockquote></div><br></div></div>