Thread Subject: sprintf fixed number of spaces per column?

Subject: sprintf fixed number of spaces per column?

From: Johnathan

Date: 1 Jun, 2009 19:23:01

Message: 1 of 1

In Fortran you can do columns by using printf and allowing for only a certain number of digits, but I it seems as though Matlab is a little different.

sprintf('%-5f %-5f',123456.1,123456.1)

ans =

123456.100000 123456.100000

if I remember right, something like this in fortran this would return

ans=
1234512345

how do I get there to be a set number of spaces available per item, and characters that overflow are simply not printed?

Thanks
--John

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
sprintf Johnathan 1 Jun, 2009 15:24:05
columns Johnathan 1 Jun, 2009 15:24:05
rssFeed for this Thread

Contact us at files@mathworks.com