octave-maintainers
[Top][All Lists]
Advanced

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

Re: displaying structures array as table


From: Ben Abbott
Subject: Re: displaying structures array as table
Date: Tue, 30 Aug 2011 17:21:31 -0400

On Aug 30, 2011, at 2:41 PM, John W. Eaton wrote:

I don't object to improving the default display functions, but no
matter what we do we are unlikely to please everyone all the time.  So
maybe it would be best if we allowed users to customize the output by
defining a function?

jwe

I was thinking this was already possible, but then noticed a subtle difference between how the @class stuff works for Matlab and Octave.

If I create a directory named "@cell" and place a display.m function (below) in it ...

function display (a)
  disp ('My display method')
  disp (a)
end

.... then from the following at the ML command prompt I see

>> a = {'a',1}
My display method
    'a'    [1]

However, from Octave I get ....

>> a = {'a', 1}
a = 
{
  [1,1] = a
  [1,2] =  1
}
>> display (a)
My display method

{
  [1,1] = a
  [1,2] =  1
}
>> disp (a)

{
  [1,1] = a
  [1,2] =  1
}

It appears that ML and Octave are using methods of different names to display the contents of built-in objects.

My understanding is that  Matlab's default method for displaying an objects content is ...

function display (a)
  disp (a)
end

Ben


reply via email to

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