Question using fprintf for words

2 次查看(过去 30 天)
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

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2014-11-20
编辑:Azzi Abdelmalek 2014-11-20
A= {'jan','feb','march','april'};
fprintf('%s \n',A{:})

更多回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Entering Commands 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by