help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dynamic format specifiers


From: Bart Vandewoestyne
Subject: dynamic format specifiers
Date: Wed, 29 Jul 2009 11:41:17 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello list,

Consider the following code for writing out a matrix with 3
columns:

  A = rand(10,3);
  printf('%g %g %g\n', A');

Now in my application, I dont know the number of columns of A in
advance.  So I have something like:

  A = rand(10,k);

where k can be any value.

The problem that then arises, is that the format string with the
'%g' changes at run time.

How do i change my printf statement so that it works with any
number of columns of A?

Thanks,
Bart

-- 
        "Share what you know.  Learn what you don't."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]