2010年4月16日星期五

Scilab: Read file

When the data file is too large, one cannot read all of them into stack. Instead one has to read line by line and only put those usefull data into stack. To read a data file line by line, one can do it in the following way.

fid = mopen('D:\WORK\pe1.TXT', "r");
while (done_yet == 0);
[num_read, val(1), val(2)] = mfscanf(fid, "%f %f");

... ...

if (num_read <= 0);
done_yet = 1;
end
end;

Firstly, open the file.
Then read data in format from one line.
Deal with the data.
If the file is not end, continue reading.

Scilab: Increase stacksize

stacksize()

This command will return two numbers. The first one is the current stacksize, and the second one is how much in use. One can give these values to a variable by

v = stacksize()

To increase the stacksize, use

stacksize(n)

where n is a number that is the stacksize that one wants to set.

2010年3月17日星期三

WPS:插入矢量图形

有时候想要整理一下数据,写一些简单的总结,又没有很多公式要输入时,就不想用Latex了。而且Latex的表格不方便。(学会lyx之后也许可以解决这个问题。)这时候就想用WPS。

WPS默认的版本不能插入eps格式的矢量图。上网搜索了一下,有人为WPS写了一个插入矢量图的插件。原帖见WPS office论坛,链接在此。下载并安装那个插件之后,在WPS的“插入”菜单下面多了一项“插入矢量图形”。我尝试了一下,至少eps格式是可以的。

Scilab: 画二维曲线时如何加入误差

只要在原本的plot命令后面,再加入下面的这条命令:

errbar(x,y,em,ep)

parameters:
x:横坐标 horizontal coordinates
y:纵坐标 vertical coordinates
y-em:误差下限 lower error limits
y+ep:误差上限 upper error limits