returns a string able to generate a given Scilab object
t = sci2exp(a) t = sci2exp(a, LHSname) t = sci2exp(a, LHSname, lmax) t = sci2exp(a, lmax)
a scilab object. The supported types are:
sci2exp
For booleans, encoded integers, real or complex numbers, polynomials and strings, any of a single element or a vector or a matrix or an hypermatrix is accepted.
Optional string: The name of the variable building the assignment prefix
LHSname+" = "
. When it is provided, LHSname+" = "
is prepended to the raw expression yielded from the a
object.
Then, the result string t
can no longer be evaluated with
evstr()
but with execstr()
.
Column of strings. A single whole string is returned when lmax
is not used or is set to 0: The Scilab literal expression, with possibly
the left-hand affectation part on the first line when LHSname
is provided.
Positive integer setting the maximal length of the t
components. The default value 0
ignores such a constrain
and returns t
as a single (long) string. Otherwise,
some continuation marks ..
are used to break too long
rows.
![]() | Since continuation marks .. prevent using
evstr() and execstr() , using this
lmax option mostly cancels the main sci2exp()
purpose. |
"sci2exp" stands for the conversion of a scilab object into a literal executable expression.
![]() |
|
With a numerical matrix:
--> a = [%i 2 ; 3 4-2*%i] a = i 2. 3. 4. - 2.i --> sci2exp(a) ans = [%i,2;3,4-%i*2] --> sci2exp(a, 'aa') ans = aa = [%i,2;3,4-%i*2] --> sci2exp(a, 'aa', 10) ans = !aa = [ ! !%i,2; ! !3,4-%i*2] !
With some other types of objects:
sci2exp(ssrand(2,2,2)) // a typed list created with tlist() sci2exp(figure("figure_name","figure1")) // a graphic handle | ![]() | ![]() |
Impact of format() on literal output numbers:
p = [0.123456789, %z-%pi*%i]; pol2str(p) // also impacted by format() format(20); Lp = sci2exp(p) // Literal encoding Rp = evstr(Lp); pol2str(Rp) // Regenerated from literal Rp == p format(10); // Let's truncate the literal output before calling sci2exp() Lp = sci2exp(p) Rp = evstr(Lp); format(20); pol2str(Rp) Rp == p | ![]() | ![]() |
--> p = [0.123456789, %z-%pi*%i]; --> pol2str(p) ans = !0.1234568 -%i*3.1415927+z ! --> format(20) --> Lp = sci2exp(p) Lp = [0.12345678900000000,-%i*3.14159265358979310+%z] --> Rp = evstr(Lp); pol2str(Rp) ans = !0.12345678900000000 -%i*3.14159265358979310+z ! --> Rp == p ans = T T --> format(10) // Let's truncate the literal output before calling sci2exp() --> Lp = sci2exp(p) Lp = [0.1234568,-%i*3.1415927+%z] --> Rp = evstr(Lp); format(20); pol2str(Rp) ans = !0.12345680000000001 -%i*3.14159269999999990+z ! --> Rp == p ans = F F
Version | Description |
6.0.2 | The name of the predefined variables %s and
%z is now used as literal generator for input polynomials in
s or z . |