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


conversion to string


text = string(x)
[out, in, text] = string(SciFun)



a boolean, complex, real, integer, polynomial matrix, an implicitlist (like 1:$), a library of functions in Scilab language.


a function in Scilab language (type 13, not its name as a string).


The string function converts a matrix x into a matrix of strings.

If SciFun is a function, [out,in,text] = string(SciFun) returns three vectors of strings:

  • out is the row vector of names of its output variables,
  • in is the row vector of names of its input variables, and
  • text is the column vector of the source code of the function.

If x is a lib variable (library), text is a character string column vector. The first element contains the path of library file and the other the name of functions it defines.

For any complex, real, integer, polynomial or rational input, the format of literal numbers output from string(..) is managed by the format function (see examples).

Note that string([]) returns [] (unchanged).


string(rand(2, 2))

deff("y = mymacro(x)", "y = x + 1")
[out, in, text] = string(mymacro)
x = 123.356;
disp("Result is " + string(x));

disp("/" + string(~%t) + "/");
disp("/" + string(%i+1) + "/");
disp("/" + string(int16(-123)) + "/");
disp("/" + string(1 + %s + %s^3) + "/");


v = format();


See also

  • format — set the default output format of decimal numbers
  • sci2exp — returns a string able to generate a given Scilab object
  • msprintf — converts, formats, and writes data in a string
  • tree2code — generates the text definition of a Scilab function from its internal code
  • pol2str — polynomial to string conversion
  • execstr — execute Scilab code in strings
  • evstr — evaluates Scilab expressions and concatenates their results
  • strtod — parse and convert literal numbers STRings TO Decimal numbers
  • csvTextScan — Converts into a matrix texts representing separated values


5.4.0 Input of implicitlist typeof accepted.
Report an issue
<< strindex Strings stripblanks >>

Copyright (c) 2022-2023 (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:
Mon Mar 27 11:52:45 GMT 2023