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

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

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

Scilab Help >> GUI > x_matrix


Edits a matrix and waits for validation (modal)


matrixOut = x_matrix(Header, matrixIn)


column vector of text: Text displayed before the matrix. Extended UTF-8 characters are supported. Any element starting with "<body>" can use HTML.4 tags afterward.

Initial vector or matrix of booleans, encoded integers, real or complex numbers, or text.

Modified matrix, of the same type than matrixIn, if "OK" is pressed. Or [] if "Cancel" is pressed.


Edits a matrix in a modal way: Scilab is paused while the matrix is displayed and the user can modify it. One of both buttons "OK" or "Cancel" must be clicked to validate or cancel modifications. Either the modified matrix or [] is returned accordingly. Then Scilab resumes the execution of next instructions.

The pop-up is sized according to the displayed matrix. It can be resized interactively. If it becomes narrower than the matrix or the header, long header lines are wrapped, and some scroll bars appear.


i = int8(grand(3,4,"uin",-150,150))

// With booleans
b = i > 0
m = x_matrix("<html><body>Matrix of <b>booleans", b)

// With encoded integers
m = x_matrix("<html><body>Matrix of <b>int8 integers", i)

// With real numbers
c = grand(5,4,"uin",-15,15) + grand(5,4,"uin",0,9)/10;
c([14 8 16]) = [%nan %inf -%inf]
m = x_matrix("<html><body>Matrix of <b>decimal numbers", c)

// With complex numbers
c = grand(5,3,"uin",-15,15) + grand(5,3,"uin",-15,15)*%i;
c(2,2) = 3-1.24e-31*%i;
c(4,3) = complex(0,%nan)
m = x_matrix("<body>Matrix of <b>complex numbers", c)

// With texts
t = ["ab" "I don''t" "αβδεϵζ"
     "j"  """Yes"""  "àéêèïôûù"]
m = x_matrix("<body>Matrix of <b>text", t)

With a multiple-line and styled header:

online = "";
header = ["<body><h3>Head line"
          "The pop-up can be resized. Some scroll bars may appear."
          "<body>This <font color=''red''><b>word</b></font> is bold and red. " + ..
          "<body>x_matrix <a href=''" + online + "''>online page</a>."
b = grand(4,14,"uin",-2,1) < 0
m = x_matrix(header, b)

See also

  • x_mdialog — Dialog for interactive vector/matrix input.
  • x_dialog — Dialog for interactive multi-lines input.
  • editvar — Scilab variable editor
  • uicontrol table — create a Graphic User Interface object
  • messagebox — Open a message box.
  • prettyprint — Converts a Scilab object into some corresponding LaTeX, TeX, MathML or HTML strings


6.1.1 Booleans, encoded integers, and text are supported. The display of real and complex matrices is improved.
Report an issue
<< x_dialog GUI x_mdialog >>

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 Jan 03 14:23:29 CET 2022