Can one substitute string values in a matrix?

1 visualizzazione (ultimi 30 giorni)
I create
dum=zeros(height(T),1)
I want Matlab to fill all the values of dum with a string 'January'. How is it possible?

Risposta accettata

madhan ravi
madhan ravi il 7 Dic 2020
dum = strings(height(T), 1); % you could also use repmat or repelem to do it in one line
dum(:) = "January";

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by