cell and strings in an array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Michael Angeles
am 29 Jan. 2022
Beantwortet: Voss
am 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?
0 Kommentare
Akzeptierte Antwort
Voss
am 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!