cell and strings in an array
    1 visualizzazione (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
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 Commenti
Risposta accettata
  Voss
      
      
 il 29 Gen 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 Commenti
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Cell Arrays in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!