Re: Output format problem
Nicholas Jankowski <[email protected]> Mon, 20 Sep 2021 11:07:30 -0400
| Newsgroups | gmane.comp.gnu.octave.general |
|---|---|
| Message-ID | <CALW4+bKRU2FeEPqB1iHD0Ti+u8bkD9oNctemM8XqBudbducOmA@mail.gmail.com> |
On Mon, Sep 20, 2021 at 7:18 AM Samuel Doughty <[email protected]> wrote: > I want to print three items on a single line: an integer, a name, and a > floating point value using the printf statement. Call them nn, name, and > value. How do I write this command? > > There are a couple examples of using printf in the Octave manual. See: https://octave.org/doc/latest/Formatted-Output.html for example: pct = 37; filename = "foo.txt"; printf ("Processed %d%% of '%s'.\nPlease be patient.\n", pct, filename); so, it seems you would use something like printf (" integer %d, name %s, value %g", nn, name, value); for syntax see https://octave.org/doc/v6.3.0/Table-of-Output-Conversions.html ---------- We are transitioning to a web based forum for community help discussions at https://octave.discourse.group/c/help