cell and strings in an array
1 view (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
Voss
on 29 Jan 2022
try
data = cell(4:24);
catch ME
disp(ME.message);
end
If you want each cell of data to contain {'AD';'ED';'FA';'DE'}:
data = cell(4,24);
data(:) = {{'AD';'ED';'FA';'DE'}};
disp(data);
If instead you want each column of data to be {'AD';'ED';'FA';'DE'}:
data = repmat({'AD';'ED';'FA';'DE'},1,24);
disp(data);
0 Comments
More Answers (0)
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!