In [1]:
# you must have scilab in your path, like below
import os
os.environ["PATH"] = os.environ["PATH"]+";"+r"C:\Users\famille\AppData\Local\scilab-5.4.1\bin"
In [2]:
# this currently suppose to have done pip install import scilab2py
# with scilab2py > 0.3 (not yet out)
import scilab2py
import numpy as np
sci = scilab2py.Scilab2Py()
x = sci.eval("zeros(3,3)")
x
Out[2]:
In [3]:
%load_ext scilab2py.ipython
In [4]:
x = %scilab 2+2
In [5]:
x = %scilab [1 2; 3 4];
x
Out[5]:
In [6]:
a = [1, 2, 3]
%scilab_push a
%scilab a = a * 2;
%scilab_pull a
a
Out[6]:
In [7]:
%%scilab -i x -o y
y = x + 3;
y
In [8]:
%%scilab -f svg
xset("fpf"," ")
contour2d(1:10,1:10,rand(10,10),5,rect=[0,0,11,11]);
In [9]:
%%scilab -f jpg
# simple plot using z = f(x, y)
t = [0: 0.3: 2 * %pi]';
z = sin(t) * cos(t');
plot3d(t, t, z);
In [12]:
sci=scilab2py.Scilab2Py()
In [13]:
sci.eval("2+2")
Out[13]:
In [11]:
%%scilab -f png
[x, y] = meshgrid(0:0.1:3);
r = sin(x - 0.5).^2 + cos(y - 0.5).^2;
surf(x, y, r);
In [12]:
%%scilab -g
plot([1,2,3])
# brings up a Scilab plotting GUI
In [13]:
%scilab exists ones
Out[13]:
In [ ]: