Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.2 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Matlab to Scilab Conversion Tips > About M2SCI tools

About M2SCI tools

Generally speaking about tools to convert Matlab files to Scilab

Description

Scilab includes useful tools to convert Matlab M-files to Scilab.

Taking a Matlab M-file, mfile2sci modifies this files so that it can be compiled by Scilab. After that this compiled code is converted to a "tree" of instructions by macr2tree. This "tree" is an imbrication of Scilab lists and tlists and is the basis for conversion. Each instruction of this "tree" is converted to Scilab and inference is done to known what are the variables. Once this "tree" is converted to Scilab, code is generated using tree2code.

All tlists used for coding this tree (and we call "MSCI tlists") are listed below:

  • funcall

    tlist representing a function call created by Funcall

    operation

    tlist representing an operation created by Operation

    variable

    tlist representing a variable created by Variable

    cste

    tlist representing a constant created by Cste

    equal

    tlist representing an instruction created by Equal

    ifthenelse

    tlist representing an IF/THEN/ELSE control instruction created inside M2SCI kernel functions

    while

    tlist representing a WHILE control instruction created inside M2SCI kernel functions

    selectcase

    tlist representing a SELECT/CASE control instruction created inside M2SCI kernel functions

    for

    tlist representing a FOR control instruction created inside M2SCI kernel functions

The contents of these tlists is described in corresponding help pages.

Operations are converted using a fonction named %<opcode>2sci with opcode the Scilab code for this operator. See help page for overloading to have these codes. All these functions are already written and are in directory SCI/modules/m2sci/macros/percent/.

Function calls are converted using a function called sci_<Matlab_function_name>. Some of these functions have been written and are in directory SCI/modules/m2sci/macros/sci_files/. We are working on increasing the set of Matlab functions converted. However, everybody can written such functions using help page sci_files.

Inference is done using tlists of type "infer" containing fields:

  • dims

    list of dimensions

    type

    "type" tlist

    contents

    "contents" tlist if a Cell or a Struct

Type is a tlist of type "type" containing fields:

  • vtype

    data type

    property

    property

To have more details about inference see help page for m2scideclare.

See Also

  • mfile2sci — Matlab M-file to Scilab conversion function
  • translatepaths — convert a set of Matlab M-files directories to Scilab
  • overloading — display, functions and operators overloading capabilities
  • sci_files — How to write conversion functions
  • Funcall — Create a tree representing a function call
  • Operation — Create a tree representing an operation
  • Variable — Create a tree representing a variable
  • Cste — Create a tree representing a constant
  • Infer — Create a tree containing inference data
  • Type — Create a tree containing type inference data
  • Equal — Create a tree representing an instruction
  • m2scideclare — Giving tips to help M2SCI...
Report an issue
<< Matlab-Scilab equivalents Matlab to Scilab Conversion Tips Contents >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Apr 01 10:14:07 CEST 2015