MATLAB Answers

Can one substitute string values in a matrix?

14 views (last 30 days)
alpedhuez
alpedhuez on 7 Dec 2020
Commented: alpedhuez on 7 Dec 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?

  0 Comments

Sign in to comment.

Accepted Answer

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

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by