proper orientation & writing to text file

9 次查看(过去 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

采纳的回答

Walter Roberson
Walter Roberson 2012-11-23
sample1 = {'Software','UserName','Author'}; %NOT square brackets!
fprintf('%14s %-14s %14s\n', sample1{:});
  4 个评论
Jan
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?
Walter Roberson
Walter Roberson 2012-11-27
Looks like all of shaz's comments are gone :(

请先登录,再进行评论。

更多回答(0 个)

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by