octave-maintainers
[Top][All Lists]
Advanced

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

Re: cell-array display in class


From: Oliver Heimlich
Subject: Re: cell-array display in class
Date: Mon, 27 Apr 2015 08:04:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0

On 27.04.2015 06:05, Oliver Heimlich wrote:
On 26.04.2015 22:35, Colin Macdonald wrote:
Hi,

I like how Octave displays cell arrays.  Is it possible to enable the
`[i,j] = ` display in my own class?  If so, how?  If not, I'll file a
bug to improve on the status quo shown below.

Example: good:

>> C = {1 2; 3 4}
C =
{
  [1,1] =  1
  [2,1] =  3
  [1,2] =  2
  [2,2] =  4
}

Not so good:

>> pkg load symbolic
>> pkg load interval

>> C(2,1) = sym('x')
C =
{
  [1,1] =  1
(sym) x
  [1,2] =  2
  [2,2] =  4
}
>> C(2,2) = infsup(0,5)
C =
{
  [1,1] =  1
(sym) x
  [1,2] =  2
[0, 5]
}

Colin,

I just debugged into the display method. If inputname(1) is an empty
string, the method could use the variable “argn” to get the coordinates
within the cell array and produce the desired output.

Oliver


It is not so easy. First, you have to decide whether “argn” represents coordinates of a cell-array. You could do this with a regular expression, but can't be 100% sure.

Second, you want to get access to the following variable (in ov-base.cc) to correctly indent your output. I think there currently is no way to access this value from within a m-file display method (unless you use an oct-file kludge).
   int octave_base_value::curr_print_indent_level



reply via email to

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