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

« back to all changes in this revision

Viewing changes to man/programming/execstr.cat

  • 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
execstr           Scilab Group           Scilab Function            execstr
 
2
NAME
 
3
   execstr - execute Scilab code in strings
 
4
  
 
5
CALLING SEQUENCE
 
6
 execstr(instr)
 
7
 ierr=execstr(instr,'errcatch' [,msg])
 
8
PARAMETERS
 
9
 instr      : vector of character strings, Scilab instruction to be
 
10
            executed.
 
11
            
 
12
 ierr       : integer, 0 or error number.
 
13
            
 
14
 msg        : character string with values 'm' or 'n'.  Default value is
 
15
            'n'.
 
16
            
 
17
DESCRIPTION
 
18
   Executes the Scilab instructions given in argument instr.
 
19
  
 
20
   If the 'errcatch' flag is not present, error handling works as usual.
 
21
  
 
22
   If the 'errcatch' flag is set, and an error is encountered while
 
23
  executing the instructions defined in instr, execstr issues no error
 
24
  message, but aborts execution of the instr instructions (at the point
 
25
  where the error occurred), and resumes with ierr equal to the error
 
26
  number.  In this case the display of the error message is controlled by
 
27
  the msg option:
 
28
  
 
29
 "m"        : error message is displayed and recorded.
 
30
            
 
31
 "n"        : no error message is displayed, but the error message is
 
32
            recorded (see lasterror).  This is the default. 
 
33
            
 
34
EXAMPLE
 
35
 execstr('a=1') // sets a=1.
 
36
 execstr('1+1') // does nothing (while evstr('1+1') returns 2)
 
37
 
 
38
 execstr(['if %t then';
 
39
          '  a=1';
 
40
          '  b=a+1';
 
41
          'else'
 
42
          ' b=0'
 
43
          'end'])
 
44
 
 
45
 execstr('a=zzzzzzz','errcatch')
 
46
 execstr('a=zzzzzzz','errcatch','m')
 
47
SEE ALSO
 
48
   evstr, lasterror, error
 
49