Can one substitute string values in a matrix?

1 Ansicht (letzte 30 Tage)
alpedhuez
alpedhuez am 7 Dez. 2020
Kommentiert: alpedhuez am 7 Dez. 2020
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?

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by