proper orientation & writing to text file
2 次查看(过去 30 天)
显示 更早的评论
i have a string like
sample1 = ['Software','UserName','Author'];
sample2 = ['Matlab','john','Author1'];
sample3 = ['c','wright','Author2'];
now i need to write to txt file in below format
sample output format
Software UserName Author
Matlab john Author1
c wright Author2
problem is not able to adjust whitespaces
0 个评论
采纳的回答
Walter Roberson
2012-11-23
sample1 = {'Software','UserName','Author'}; %NOT square brackets!
fprintf('%14s %-14s %14s\n', sample1{:});
4 个评论
Jan
2012-11-27
@Walter: It seems like your comments have lost their context. Did somebody delete some other comments? If so, who and why?
更多回答(0 个)
另请参阅
类别
在 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!