Question using fprintf for words

10 views (last 30 days)
benny
benny on 20 Nov 2014
Edited: Image Analyst on 21 Nov 2014
I know how to use fprintf for a string of numbers but I was wondering if there is way to assign it to variable or words such as
A= ['jan','feb','march','april']
fprintf('% \n',A)
to get output
jan
feb
march
april

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 20 Nov 2014
Edited: Azzi Abdelmalek on 20 Nov 2014
A= {'jan','feb','march','april'};
fprintf('%s \n',A{:})

More Answers (1)

Chad Greene
Chad Greene on 20 Nov 2014
Curly brackets and disp would be a different way:
A= {'jan','feb','march','april'}
disp(A)

Categories

Find more on Entering Commands in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!