~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to examples/interface-tour/intex11f.f

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
      subroutine intex11f(fname)
 
2
      include 'stack.h'
 
3
c     -----------------------------------
 
4
c     Executing the Scilab function "myfct" defined in ex11f.sce
 
5
      character*(*) fname
 
6
      logical getrhsvar, scistring
 
7
      logical checklhs,checkrhs
 
8
c
 
9
       minrhs=6
 
10
       maxrhs=6
 
11
       minlhs=1
 
12
       maxlhs=3
 
13
c
 
14
       if(.not.checkrhs(fname,minrhs,maxrhs)) return
 
15
       if(.not.checklhs(fname,minlhs,maxlhs)) return
 
16
c
 
17
      if(.not.getrhsvar(1,'d',m1,n1,l1)) return
 
18
      if(.not.getrhsvar(2,'d',m2,n2,l2)) return
 
19
      if(.not.getrhsvar(3,'d',m2,n2,l2)) return
 
20
      if(.not.getrhsvar(4,'d',m2,n2,l2)) return
 
21
      if(.not.getrhsvar(5,'d',m2,n2,l2)) return
 
22
      if(.not.getrhsvar(6,'d',m2,n2,l2)) return
 
23
 
 
24
c     We receive 6 input variables indexed by (1,2,...6)
 
25
c     when the command ex11f(x1,x2,x3,x4,x5,x6) is issued.
 
26
 
 
27
c     We have a Scilab function "myfct" with mrhs=2 inputs 
 
28
c     and mlhs=3 outputs:
 
29
 
 
30
c     function [u,v,w]=myfct(x,y)','u=7+x,v=8+y,w=9+y')
 
31
c     To run myfct with input variables x5 and x6,
 
32
c     we must set ifirst=5. Variables passed to the function must
 
33
c     appear consecutively with index ifirst, ifirst+1,..., ifirst+mrhs.
 
34
      mlhs=3
 
35
      mrhs=2
 
36
      ifirst=5
 
37
c     Variables #5 (x5) and #6 (x6) are the two inputs (x,y above) of "myfct",
 
38
c     i.e. myfct(x5,x6) is executed now:
 
39
      if(.not.scistring(ifirst,'myfct',mlhs,mrhs)) return
 
40
 
 
41
c     Output variables u, v, and w of myfct 
 
42
c     are now indexed by ifirst, ifirst+1, ifirst+mlhs i.e.
 
43
c     u and v are indexed by 5 and 6 resp. and w (created by myfct)
 
44
c     is indexed by 7.
 
45
c     We return u v and w:
 
46
c     Caution: Variables with index larger than ifirst+mrhs cannot be 
 
47
c     returned to Scilab.
 
48
 
 
49
       lhsvar(1)=5
 
50
       lhsvar(2)=6
 
51
       lhsvar(3)=7
 
52
c
 
53
       end
 
54
 
 
55
 
 
56