Cygwin上のOctaveとgnuplotの連携設定
2005.3.1
2005.3.29改定
Octaveとgnuplotに関しては、次の情報を参考にしました。
数値計算環境構築に関する情報
・インストールしたソフト: Octave-2.1.64およびgnuplot-4.0
注) Octaveの最新versionは、2005年3月現在では2.1.67で、以下の説明は一部異なります。
それぞれの展開先は、次の場所にしてみました。
octave:c:/cygwin/usr/local/share ,
gnuplot: c:/gp400win32/gnuplot
・pathの初期設定
(1)octaveの起動設定 /usr/local/share/octave/2.1.64/m/startup/octavercを編集:3行追加
gnuplot_binary = 'pipe-gnuplot c:/cygwin/gp400win32/gnuplot/bin/pgnuplot.exe'
putenv('TMPDIR','c:/cygwin/tmp')
gnuplot_has_multiplot = 1
(2) ユーザ ディレクトリにおけるpath設定 windowsのエクスプローラでユーザディレクトリにある
”.bashrc”を開き、次の行を確認&追加
(注)Octave-2.1.67をインストールされる場合は、追記は不要です。
・・・・・・・・・・・・・・・
export SHELL=/bin/bash
export HOME=/home/***** #*****:ユーザ名i
export TMPDIR=/tmp
export TZ=JST-09
export MAKE_MODE=unix
PATH=/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin
PAGER=less
JLESSCHARSET=japanese-sjis
export PATH PAGER JLESSCHARSET
・・・・・・・・・・・・
以上のようなインストールと設定作業の後、必ずしも期待のように動作しませんでした。
その後の”苦闘の跡”をご覧下さい。
1 インストールした直後のトライ結果:
(注)以下の説明はOctave-2.1.64の場合です。
octaveの計算部分は実行されますが、Plotはできませんでした。
<octaveの起動とy=sin(x)の計算と表示エラー>
(ユーザ名)@(PC名) /
$ octave
GNU Octave, version 2.1.64 (i686-pc-cygwin).
Copyright (C) 2004 John W. Eaton.
This is free software; see the source code for
copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for
MERCHANTIBILITY or
FITNESS FOR A PARTICULAR PURPOSE. For details, type `warranty'.
Additional information about Octave is available at
http://www.octave.org.
Please contribute if you find this software useful.
Report bugs to <bug@octave.org> (but first,
please read
http://www.octave.org/bugs.html to learn how to write
a helpful report).
octave:1> x=0:0.1:7;
octave:2> y=sin(x);
octave:3> plot(x,y);
pgnuplot: not found
warning: broken pipe
octave:4> quit
pgnuplot: not found
(ユーザ名)@(PC名) /
$ find /usr/ |grep pgnuplot
/usr/local/bin/pgnuplot
(ユーザ名)@(PC名) /
<directory構成などの確認>
(ユーザ名)@(PC名) /
$ cd /cygdrive
(ユーザ名)@(PC名) /cygdrive
$ ls
ls: reading directory .
c e
(ユーザ名)@(PC名) /cygdrive
$ ls ./c
AUTOEXEC.BAT MSDOS.SYS
BJPrinter NTDETECT.COM
CONFIG.SYS Program Files
Documents and Settings RECYCLER
IO.SYS System Volume In
Inetpub WINDOWS
(ユーザ名)@(PC名) /cygdrive
$ ls ./c/cygwin
0-REGTYPE
0-REGTYPE-TEXT
0-REGTYPE-VEEEERY_LONG_NAME
1-LNKTYPE
2-SYMTYPE
S-SPARSE-WITH-NULLS
archive
bin
cygwin.bat
cygwin.ico
etc
gp400win32
gp400win32.zip
hello-test.exe
hello.c
home
lib
sbin
setup-2.457.2.2.exe
setup.exe
setup.log
setup.log.full
tmp
usr
var
(ユーザ名)@(PC名) /cygdrive
$ pwd
/cygdrive
(ユーザ名)@(PC名) /cygdrive
$ df
Filesystem
1K-blocks Used Available Use%
Mounted on
C:\cygwin\bin
78140128 21488364 56651764
28% /usr/bin
C:\cygwin\lib
78140128 21488364 56651764
28% /usr/lib
C:\cygwin
78140128 21488364 56651764
28% /
c:
78140128 21488364 56651764
28% /cygdrive/c
e:
29761888 12364080 17397808
42% /cygdrive/e
(ユーザ名)@(PC名) /cygdrive
$
2. エラー対策と試行
(注)以下の説明はOctave-2.1.64の場合です。
(1).pgnuplot.exeのコピーを/usr/local/bin に配置した場合:
→エラーになりました。
octave:4> plot(x,y);
octave:5> ERROR 2: Couldn't
execute: "wgnuplot.exe"
Signal 127
(2) もとに戻した場合:
octave:5> plot(x,y);
warning: broken pipe
octave:6> pgnuplot: not found
octave:6>
(3)./usr/local/bin/に pgnuplot.exeとwgnuplot.exeのcopyして配置した場合:
→gplotが実行されるようになりました。
(ユーザ名)@(PC名) /i ~
$ ls /usr/local/bin
mkoctfile
octave-bug
octave-config-2.1.64
pipe-gnuplot.exe
mkoctfile-2.1.64
octave-bug-2.1.64 octave.exe wgnuplot.exe
ctave-2.1.64.exe
octave-config pgnuplot.exe
(ユーザ名)@(PC名) / ~
octave:8> plot(x,y);
octave:9> plot(x,y);
octave:10>
$
これでやっと、”成功!!”というところです。