Question using fprintf for words

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

 采纳的回答

A= {'jan','feb','march','april'};
fprintf('%s \n',A{:})

更多回答(1 个)

Curly brackets and disp would be a different way:
A= {'jan','feb','march','april'}
disp(A)

类别

帮助中心File Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by