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: Kai Torben Ohlhus
Subject: [Octave-bug-tracker] [bug #49979] format compact/loose different from Matlab
Date: Thu, 5 Jan 2017 10:26:43 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

Follow-up Comment #1, bug #49979 (project octave):

For Matlab R2016b I get:

*Scalars*


>> format compact
>> theta = pi/2
theta =
    1.5708
>> format loose
>> theta = pi/2

theta =

    1.5708

>>


*Matrices*


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

x =

     8     1     6
     3     5     7
     4     9     2

>>


*Cell arrays*


>> format compact
>> y = {magic(2); magic(3)}
y =
  2×1 cell array
    [2×2 double]
    [3×3 double]
>> format loose
>> y = {magic(2); magic(3)}

y =

  2×1 cell array

    [2×2 double]
    [3×3 double]

>>


I think Octave and Matlab produce reasonable output. For your last example,
Matlab chooses a more pragmatic approach to avoid too verbose output. Maybe we
can also adapt this for matrices? For scalars one gets in Matlab the values
(as `1x1 double` is less informative than printing out the value itself):


>> format compact
>> y = {3; magic(2)}
y =
  2×1 cell array
    [         3]
    [2×2 double]
>> format loose
>> y = {3; magic(2)}

y =

  2×1 cell array

    [         3]
    [2×2 double]

>>


    _______________________________________________________

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]