File: mfile2sci.cat

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 (104 lines) | stat: -rw-r--r-- 3,807 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

mfile2sci(1)                   Scilab Function                   mfile2sci(1)
NAME
  mfile2sci - Matlab M_file to scilab translation function

CALLING SEQUENCE
  mfile2sci(M_file_path [,result_path [,Imode [,Recmode]]])

PARAMETERS

  M_file_path    : a character string which gives the path of Matlab M_file
                 to translate

  result_path    : a character string which gives the directory where the
                 result has to be written. Default value is current direc-
                 tory.

  Imode          : Boolean flag, If true mfile2sci ask user for variable type
                 and sizes when he cannot infer them. Default value : %f
  Recmode   : Boolean flag, used by translatepaths function. Must be %f to
            translate a single mfile.
DESCRIPTION
  mfile2sci, is Matlab M-file to Scilab function traduction tools. It tries
  whenever possible to replace call to Matlab functions by the equivalent
  scilab primitives and functions.
  To translate a Matlab M-file just enter the scilab instruction:
  mfile2sci(file)

  where file is a character string giving the path name of the M-file
  mfile2sci will generate three files in the same directory

  <function_name>.sci      : the scilab equivalent of the m_file

  <function_name>.cat      : the scilab help file associated to the function

  sci_<function_name>.sci  : the scilab function required to translate
                             the calls to this  Matlab M_file in other Matlab
  M_files.
                             this function may be improved "by hand".

  Some functions like eye, ones, size, sum,... behave differently according
  to the dimension of their arguments. When mfile2sci cannot infer dimensions
  it replaces these function call by a call to an emulation function named
  mtlb_<function_name>. For efficiency these functions may be replaced by the
  proper scilab equivalent instructions.

  Some other functions like plot, has no straightforward translation in sci-
  lab. They are also replaced by an emulation function named
  mtlb_<function_name>.

REMARKS
  This function is a still under developpement and is delivered as beta test.

  Some Matlab4 basic functions are yet translated. It is quite simple to add
  it. See <SCIDIR>/macros/m2sci/README for more details.
KNOWN BUGS

  1-  : m_files scripts are translated but sci_<Matlab function name>
         replaces the call to the m_file by an exec of
         an exec (.sce) file, the .sce file path may be incorrect.

  2-  : eval function instructions passed as strings are not translated.

  3-  : Syntaxes like 2.3i or 0.7j to form imaginary numbers produces an
      error. replace them by 2.3*i ,0.7*j

  4-  : most of plot function are not yet translated

  5-  : globals are not translated

  6-  : if, for, endded by the end of file produce an error, add the closing
      end's

  7-  : Loop variable of for clause is available afterwards if loops ter-
      minates
         normally in matlab; it is cleared  in Scilab generated code.

  8-  : Translation of insertion syntax such as v(:)=x or v(i,:)=x produces a
         run time error  when v is an empty vector or matrix.
         Use v=x or v(i,1:size(x,'*'))=x instead.

EXMAPLE
  //create a simple m_file
  write(TMPDIR+'rot90.m',['function B = rot90(A,k)'
  argin == 1'
  == AA((nn::--11::11,,::));;''
  == AA((mm::--11::11,,nn::--11::11));;''
  == AA((mm::--11::11,,::));;''
  == BB..'''';;''
  == AA;;''
  // translate it dor scilab
  mfile2sci(TMPDIR+'rot90.m',TMPDIR)
  // show the new code
  write(%io(2),read(TMPDIR+'rot90.sci',-1,1,'(a)'))
  // get it into scilab
  getf(TMPDIR+'rot90.sci')
  //execute it
  m=rand(4,2);rot90(m,1)

SEE ALSO
  translatepaths

AUTHOR
  Serge Steer, INRIA