Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

What is the quickest way to create an empty cell array of strings ?

cell(n,m)

creates an empty cell array of double.

How about a similar command but creating empty strings ?

like image 384
HeinrichStack Avatar asked Jan 17 '12 13:01

HeinrichStack


2 Answers

Depends on what you want to achieve really. I guess the simplest method would be:

repmat({''},n,m);
like image 162
John Avatar answered Nov 12 '22 10:11

John


Assignment to all cell elements using the colon operator will do the job:

m = 3; n = 5;
C = cell(m,n);
C(:) = {''}
like image 32
Kavka Avatar answered Nov 12 '22 11:11

Kavka