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


m2scideclare

Giving tips to help M2SCI...

Syntax

%m2scideclare variable_name|sizes|data_type|property

Arguments

variable_name

Name of the declared variable. It can be a Struct field (e.g. x(1,2).name) or describe the contents of a Cell using syntax x(1,2).entries.

NOTE that for Cells and Structs, * can be used as an index (see examples below).

sizes

Sizes of the variable declared, separated by blanks. Any unknown size can be specified with ?.

NOTE that a Matlab character string as defined between single quotes is considered as a vector of characters. Therefore, for instance the size of 'string' is |1 6|.

data_type & property

data type and property (sub-type) of the variable. Possible values are documented in the Type page.

Property values that are not defined as a constant in m2ci -- like 'int8' or 'Axes' -- must be specified without quotes in the m2scideclare statement.

Description

The main difficulty for M2SCI (mfile2sci) is to find what variables are: dimensions, type...

To help this tool, just add comments beginning with %m2scideclare in the M-file to convert, (%m2sciassume was used in previous Scilab versions and is now obsolete).

All data given by m2scideclare are compared with infered data. In case of conflict, inferred data are kept and a warning message is displayed. If you are sure about your data, report a bug.

Examples

  • %m2scideclare var1|2 3|Double|Real

    var1 is declared as a 2x3 Double matrix containing real data.

  • %m2scideclare var2|2 3 10|Double|Complex

    var2 is declared as a 2x3x10 Double hypermatrix containing complex data

  • %m2scideclare var3(1,2).name|1 10|String|?

    var3 is declared as a Struct array containing a 1x10 character string in field 'name' of struct at index (1,2)

  • %m2scideclare var4(1,5).entries|1 ?|Boolean|?

    var4 is declared as a Cell containing a row boolean vector at index (1,5)

  • %m2scideclare var4(1,6).entries|? ?|Int|?

    var4 is declared as a Cell containing a row boolean vector at index (1,5) and integer data at index (1,6)

  • %m2scideclare var5(*,*).name|1 ?|String|?

    var5 is declared as a Struct array containing a 1xn character string in all fields 'name'

  • %m2scideclare var6(2,*).entries|1 3|Double|Real

    var6 is declared as a Cell array containing a 1x3 double vector in each element of its second row

See also

  • Type — Create a tree containing type inference data

History

VersionDescription
6.1.1 m2scideclare supports all new defined vtypes and properties Polynomial, Function/Macro, Function/Builtin, String/Char, Handle/'Figure', Handle/'Axes', Int/'int8', Int/'int16', Int/'int32', Int/'int64', Int/'uint8', Int/'uint16', Int/'uint32', Int/'uint64', Sparse/Boolean. Sparse type is now actually supported.
Report an issue
<< About M2SCI tools Code Matlab => Scilab mfile2sci >>

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:
Thu Oct 24 11:13:15 CEST 2024