Can one substitute string values in a matrix?

1 visualización (últimos 30 días)
alpedhuez
alpedhuez el 7 de Dic. de 2020
Comentada: alpedhuez el 7 de Dic. de 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?

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by