# cell and strings in an array

1 view (last 30 days)
Michael Angeles on 29 Jan 2022
Answered: Voss on 29 Jan 2022
Hello,
how does one do the following:
data = cell(4:24);
data(:) = {'AD';'ED';'FA';'DE'}; <--I get an error when I assign this to the cell. How can I insert each string on the cell size above?

Voss on 29 Jan 2022
try
data = cell(4:24);
catch ME
disp(ME.message);
end
Requested array exceeds the maximum possible variable size.
If you want each cell of data to contain {'AD';'ED';'FA';'DE'}:
data = cell(4,24);
disp(data);
Columns 1 through 16 {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} Columns 17 through 24 {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell} {4×1 cell}
disp(data);