octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #49979] format compact/loose different from Ma


From: Rik
Subject: [Octave-bug-tracker] [bug #49979] format compact/loose different from Matlab
Date: Tue, 3 Jan 2017 16:49:24 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

URL:
  <http://savannah.gnu.org/bugs/?49979>

                 Summary: format compact/loose different from Matlab
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Tue 03 Jan 2017 08:49:22 AM PST
                Category: Interpreter
                Severity: 2 - Minor
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

There are a number of differences in the display of variables between Matlab
and Octave related to the compact/loose option to format.

The first, which I don't think we should change, is the the universal presence
of a newline after the name of the variable in Matlab.  Under Octave, the
interpreter makes a decision about how large the display of the variable will
be and if it is short, it puts it all on one line.  I like that.

For instructional purposes, here are the documented Matlab display of the same
variable under compact/loose


Compact:
theta = pi/2
theta =
  1.5708


and


Loose:
theta = pi/2

theta =

  1.5708


Under Octave with either format


theta = pi/2
theta =  1.5708


The question is how to display something more complicated, like a matrix,
under the two different formats.  This is the result under 4.2.0


>> x = magic (3);
>> format compact
>> x
x =
   8   1   6
   3   5   7
   4   9   2
>> format loose
>> x
x =

   8   1   6
   3   5   7
   4   9   2

>>


The difference is a newline before and after the matrix.  However, there is no
newline before the name of the variable "x =" as there is in Matlab under
format loose to help separate the interpreter command from the display.  Maybe
that is worth changing?

A second possible change is that the newline is always inserted after the
matrix object, when for cells it should be after the cell braces which mark
the start and end of the object.

An example is


>> format compact
>> y = {magic(2); magic(3)}
y =
{
  [1,1] =
     4   3
     1   2
  [2,1] =
     8   1   6
     3   5   7
     4   9   2
}
>> format loose
>> y
y =
{
  [1,1] =

     4   3
     1   2

  [2,1] =

     8   1   6
     3   5   7
     4   9   2

}
>>


Again, just a question, but maybe it would make more sense to remove the
newline before the final '}' and place it after the '}' so there was some
space before the start of the next interpreter command prompt.  Someone could
also check under Matlab and see how it treats these examples.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49979>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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