File: sci_stairs.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (56 lines) | stat: -rw-r--r-- 1,408 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
function [stk,txt,top]=sci_stairs()
// Copyright INRIA
txt=[]
if lhs==2 then
  if rhs==1 then
    stk=list('mtlb_stairs'+rhsargs(stk(top)(1)),'0','?','1','1')
  else
    r=list('mtlb_stairs'+rhsargs([stk(top-1)(1),stk(top)(1)]),'0','?','1','1')
    stk=list(r,r)
    top=top-1
  end 
else
  if rhs==1 then
    x=tempvar(1)
    if isname(stk(top)(1)) then
      y=stk(top)(1)
    else
      y=tempvar(2)
      txt=y+' = '+stk(top)(1);
    end

    if stk(top)(4)=='1' then // column vector    
      txt='plot2d2'+rhsargs([sci2exp('enn'),'0',y])
    else   // unknown shape
      txt='plot2d2'+rhsargs([sci2exp('enn'),'0',y+'(:)'])
    end
  elseif rhs==2 then     
    if isname(stk(top)(1)) then
      y=stk(top)(1)
    else
      y=tempvar(2)
      txt=[txt;y+' = '+stk(top)(1)];
    end
    if isname(stk(top-1)(1)) then
      x=stk(top-1)(1)
    else
      y=tempvar(2)
      txt=[txt;y+' = '+stk(top-1)(1)];
    end
    if stk(top)(4)=='1' then //y is a column vector 
      txt=[txt;y+' = '+y+'''']
    elseif stk(top)(3)<>'1' then //y has unknown shape
      txt=[txt;y+' = '+y(:)+'''']
    end
    if stk(top-1)(4)=='1' then //x is a column vector 
      txt=[txt;x+' = '+x+'''']
    elseif stk(top-1)(3)<>'1' then //x has unknown shape
      txt=[txt;x+' = '+x(:)+'''']
    end
    txt=[txt;
        'plot2d2'+rhsargs([sci2exp('gnn'),x,y])]
    top=top-1
  end
  stk=list(' ','-2','0','0','0')
end