How can I align text to be left-justified using fprintf?
32 次查看(过去 30 天)
显示 更早的评论
While using fprintf I would get text that aligns at the end of the word by default. I need it to be able to align at the beginning or left hand side of the word. Thanks.
0 个评论
回答(1 个)
dpb
2014-4-2
>> fprintf('%10s\n','abcdef')
abcdef
>> fprintf('%-10s\n','abcdef')
abcdef
>>
doc fprintf
read up on format string in the links thereto...
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!