File: sci_subplot.sci

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (38 lines) | stat: -rw-r--r-- 970 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function [stk,txt,top]=sci_subplot()
// Copyright INRIA
txt=[]
if rhs==2 then pause,end
if rhs==1 then
  if isnum(stk(top)(1)) then
    m=evstr(stk(top)(1))
    if type(m)==10 then  m=evstr(m),end
    p=modulo(m,10)
    n=modulo((m-p)/10,10)
    m=round((m-p-10*n)/100)
    j=int((p-1)/n)
    i=p-1-n*j
    rect=[i/n,j/m,1/n,1/m]
    i=string(i);j=string(j),n=string(n);m=string(m)
    e='xsetech('+lhsargs([i+'/'+n,j+'/'+m,'1/'+n,'1/'+m])+')'
    stk=list(e,'0','0','0','0')
  else
    stk=list('mtlb_subplot('+stk(top)(1)+')','0','0','0','0')
  end
elseif rhs==0 then
  stk=list('xsetech([0 0 1 1])','0','0','0','0')
else
  i=gettempvar(1)
  j=gettempvar(2)
  p=stk(top)(1)
  m=stk(top-2)(1)
  n=stk(top-1)(1)
  if stk(top-1)(2)=='2' then n='('+n+')',end
  if stk(top-2)(2)=='2' then m='('+m+')',end
  txt=j+' = int(('+p+'-1)/'+n+');'+i+' = '+p+'-1-'+n+'*'+j
  e='xsetech('+lhsargs([i+'/'+n,j+'/'+m,'1/'+n,'1/'+m])+')'
  stk=list(e,'0','0','0','0')
  top=top-2
end