|Subject:||Re: disp architecture|
|Date:||Fri, 25 Oct 2019 11:53:11 -0700|
On 10/25/2019 10:37 AM, John W. Eaton wrote:
On 10/25/19 1:08 PM, Rik wrote:
display() is called by the interpreter if an object needs to be printed. display() seems to take care of printing the name tag for the object, and then it calls disp() for the actual display of the object. Quoting the original example,
x = magic (3); s.a = int8 (x); s.b = single (x); disp (s) a: [3x3 int8] b: [3x3 single]You can see that disp() doesn't display a name tag nor does it do any indentation. However, if you just type 's' with no semicolon to display the structure you get
s = struct with fields:
a: [3x3 int8]
b: [3x3 single]
I thought that was the method that was called to display an object, and that it might use disp internally? And that Matlab's display method accepts a second argument to force the name tag that is used (Octave copies this feature since it appears to be required for basic compatibility even though it is not documented).
In newer versions of Matlab they seem to have a different API. But for the older one, which we need to support, see https://www.mathworks.com/help/matlab/matlab_oop/displaying-objects-in-the-command-window.html.
Anyway, I agree that compatibility is important for display and disp because they are used by classdef classes to display objects. So if we aren't compatible, display of those objects won't work as expected.
|[Prev in Thread]||Current Thread||[Next in Thread]|