Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.0 - Русский

Change language to:
English - Français - 日本語 - Português -

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

Справка Scilab >> Data Structures > cells > num2cell


converts an array into a cell array


y=num2cell(x [,dims])



a real, an integer, a boolean or a string matrix


a scalar or a vector of positive integers


a cell


num2cell converts x which is a real, a boolean, or a string matrix into a cell. If dims is not mentioned, y will have the same size as x.

But if dims is present, the dimensions of x mentioned in dims will be reduced to 1. Moreover, the dimensions of y components will be equal to the dimensions sizes of x whose numbers are in dims vector.

For example, if size(x)=[2 3 4 5 6] and dims=[2 4], then size(y)= [2 1 4 1 6], that is the sizes of the second and the fourth dimensions are reduced to 1. And size(y(i))= [1 3 1 5 1], which means that the sizes of the second and the fourth dimensions are equal to the sizes of the second and the fourth ones of x.


A = [1 2; 3 4]
M = matrix(1:24, [2 3 2 2])
c=num2cell(M,[1 2])

A = ["a", "b"; "c" "d"]

See also

  • cell — создаёт cell-массив пустых матриц
  • cell2mat — преобразование cell-массива в матрицу
Report an issue
<< makecell cells boolean >>

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:
Tue Feb 14 15:13:26 CET 2017