proper orientation & writing to text file

조회 수: 2 (최근 30일)
shaz
shaz 2012년 11월 23일
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에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by