help-octave
[Top][All Lists]
Advanced

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

Re: octave matrix output input


From: John W. Eaton
Subject: Re: octave matrix output input
Date: Fri, 5 Nov 2004 07:10:31 -0500

On  5-Nov-2004, Laurent Mazet <address@hidden> wrote:

| On Fri, 05 Nov 2004 11:27:03 +0100
| "Bernard.ROUSSELET" <address@hidden> wrote:
| > Hello
| > I am new to octave that I am using for e learning using wims.unice.fr;
| > in order to work with a mtrix, wims need to recognize it but i I enter a 
| > mtrix
| > a=[1,2;3,4], octave displays
| > 1 2
| > 3 4
| > without commas , and semi column ;
| > 
| > I have looked in the doc, in the FAQ and in the help archive without
| >  finding how to ask octave to output a matrix in the same way we enter 
| > it (ie with:    comma   , and semi column ;  )
| > can you help me?
| 
| 
| printf("[");
| for k=1:rows(a);
|   printf(repmat("%g,", 1, columns(a))(1:end-1), a(k,:));
|   printf(";");
| endfor;
| printf("]\n");

This will also work:

  octave:1> a = [1,2;3,4]
  a =

    1  2
    3  4

  octave:2> type -q a
  [ 1, 2;
    3, 4 ]

But why do you want this form of output?

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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