Display string line by line

21 Ansichten (letzte 30 Tage)
Elysi Cochin
Elysi Cochin am 3 Jun. 2022
Beantwortet: Star Strider am 3 Jun. 2022
str = {'cats', 'dogs', 'birds'};
how to display the above string in command window as
cats
dogs
birds

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by