proper orientation & writing to text file

7 vues (au cours des 30 derniers jours)
shaz
shaz le 23 Nov 2012
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

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by