Display string line by line

1 view (last 30 days)
Elysi Cochin
Elysi Cochin on 3 Jun 2022
Answered: Star Strider on 3 Jun 2022
str = {'cats', 'dogs', 'birds'};
how to display the above string in command window as
cats
dogs
birds

Accepted Answer

Star Strider
Star Strider on 3 Jun 2022
Use fprintf
str = {'cats', 'dogs', 'birds'};
fprintf('%s\n',str{:})
cats dogs birds
.

More Answers (0)

Categories

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

Community Treasure Hunt

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

Start Hunting!