MATLAB empty cell (n, m) array of strings?

What is the fastest way to create an empty array of row cells?

cell(n,m) 

creates an empty array of double cells.

How about a similar command, but creating empty lines?

+4
source share
3 answers

Depends on what you really want to achieve. I think the easiest way:

 repmat({''},n,m); 
+11
source

Assigning all the elements of the cell using the colon operator will complete the task:

 m = 3; n = 5; C = cell(m,n); C(:) = {''} 
+6
source

The cell cell created by cell (n, m) contains empty matrices, not doubles. If you really need to pre-populate the cell array with blank lines

 test = cell(n,m); test(:) = {''}; test(1,:) = {'1st row'}; test(:,1) = {'1st col'}; 
0
source

Source: https://habr.com/ru/post/1391454/


All Articles