Is it possible to create a 0-by-0 matrix (or array)?

reshapecan create both a matrix 0-by-1and a matrix 1-by-0:

>> reshape([], [0 1])
ans =
   Empty matrix: 0-by-1
>> reshape([], [1 0])
ans =
   Empty matrix: 1-by-0

reshapecan also create an n-dimensional array for n> 2, in which at least one of the sizes is 0. For example, 1

>> reshape([], [6 0 1 2 1])
ans =
   Empty array: 6-by-0-by-1-by-2

But I could not persuade reshapeto create 0-by-0anything (a matrix or an array, that is). for instance

>> reshape([], [0 0])
ans =
     []
>> reshape([], [0 0 1])
ans =
     []

Is there a way to create an object that MATLAB will interactively display as a matrix 0-by-0?

Even better, is there a way to create an object that MATLAB will interactively display as an m-by-n array for any non-negative integers m and n? 2

( , , , , .)


1 , 1 , .

2 , x, (1) isnumeric(x) true; (2) numel(x) 0; (3) x MATLAB [RETURN] Empty matrix: 0-by-0 ( Empty array: 0-by-0).

+3
2

[] - matlab 0--0. 0 0, -.

>> size(reshape([], [0 0]))

ans =

     0     0
+5

, zeros(0,0) , . , , , size:

>> size(zeros(0,0))
ans =
      0     0
+2

All Articles