help-octave
[Top][All Lists]
Advanced

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

Re: Removing disadvantages on struct array and cell struct array?


From: John W. Eaton
Subject: Re: Removing disadvantages on struct array and cell struct array?
Date: Mon, 10 Jan 2011 14:12:43 -0500

On 10-Jan-2011, Olaf Till wrote:

| Just a suggestion to make more clear what the numbers correspond to:
| what about leaving off the braces? So it would look like:
| 
|   component =
|   {
|     type =
| 
|       [1,1] = r
|       [1,2] = c
|       [1,3] = r
|    ...
| 
| This would avoid the misunderstanding with
| 
|   component =
|   {
|     type =
| 
|     {
|       [1,1] = r
|       [1,2] = c
|       [1,3] = r
|     }
|    ...
| 
| that the field "type" contains the cell-array {"r", "c", "r"}.

I checked in the following changeset:

  http://hg.savannah.gnu.org/hgweb/octave/rev/8a40037533e2

Octave will now produce output like this:

  x =

    1x3 struct array containing the fields:

      a1 = 
      {
        [1,1] = [](0x0)
        [1,2] =  1
        [1,3] = [](0x0)
      }

      b = 
      {
        [1,1] = [](0x0)
        [1,2] = [](0x0)
        [1,3] =  2
      }

with "print_struct_array_contents (true)", and

  x =

    1x3 struct array containing the fields:

      a1
      b

with "print_struct_array_contents (false)", and for scalar structs,
you will now see

  x =

    scalar structure containing the fields:

      a =  1
      b =  2

regardless of the value of print_struct_array_contents.

I agree that there are are more improvements that could be made.  For
example, we should probably be able to view cell arrays with more than
two dimensions, and it would be nice if Octave automatically detected
"large" (with the limit for "large" configurable in some way) arrays
and structures and offered the user a choice about whether to display
them before it started to format and print them.

But I have no time for any of that now and don't want to make more extensive
changes now just before the release.

jwe


reply via email to

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