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

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

[Octave-bug-tracker] [bug #49794] display vs. disp functions


From: Amro
Subject: [Octave-bug-tracker] [bug #49794] display vs. disp functions
Date: Wed, 7 Dec 2016 16:43:04 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:45.9) Gecko/20100101 Goanna/3.0 Firefox/45.9 PaleMoon/27.0.2

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

                 Summary: display vs. disp functions
                 Project: GNU Octave
            Submitted by: amro_octave
            Submitted on: Wed 07 Dec 2016 06:43:02 PM EET
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.0
        Operating System: Any

    _______________________________________________________

Details:

The function "display" in Octave behaves a bit differently than the one in
MATLAB. According to MATLAB docs:

* *disp(X)* displays the value of variable X without printing the variable
name. Another way to display a variable is to type its name, which displays a
leading "X =" before the value.

* *display(X)* is called by MATLAB for the object X when a statement is not
terminated by a semicolon.


Here is an example in MATLAB R2016b using builtin types:


>> format compact
>> x=1
x =
     1
>> disp(x)
     1
>> display(x)
x =
     1
>> 


The same in Octave 4.2.0:


>> x=1
x =  1
>> disp(x)
 1
>> display(x)
 1

>> 


I'm guessing Octave should use "inputname" inside "display" to first print the
variable name or "ans" in case the input was an expression, then use "disp"
for the rest.

Also note that the current implementation in Octave does something like this
(related to bug #49753):

str = disp(obj);
...
disp(str)

so it ends up displaying an extra new line.





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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