help-octave
[Top][All Lists]
Advanced

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

Re: exporting formatted data to a file


From: Jordi Gutiérrez Hermoso
Subject: Re: exporting formatted data to a file
Date: Mon, 4 Feb 2013 13:19:47 -0500

On 4 February 2013 12:57, marciobarbalho <address@hidden> wrote:
> I did some searching and couldn't find a command that exports formatted data
> to a file. I have tried with 'save' and 'fprintf' but none of them seems to
> do the same job as scilab's 'fprintfMat'.

This is kind of ugly, but it works:

    x = rand(20);
    function printfMat(fmt, x)
        printf([repmat(sprintf("%s ", fmt),1, columns(x)), "\n"], x)
    endfunction

    printfMat("%0.2f", x)

Obvious modifications for fprintfMat.

HTH,
- Jordi G. H.


reply via email to

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