How do I easily make a matrix variable of 5 rows, each with the same string?

1 view (last 30 days)
So I know I can type x=char('Dandy','Dandy','Dandy','Dandy','Dandy'), but how do i do it without manually retyping the word?

Accepted Answer

Star Strider
Star Strider on 30 Sep 2014
Using repmat is one way:
x = repmat('Dandy', 5, 1);

More Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!