[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: displaying structure arrays
From: |
Thorsten Meyer |
Subject: |
Re: displaying structure arrays |
Date: |
Sat, 04 Apr 2009 16:02:56 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
Francesco Potortì wrote:
>> | It seems to me that displaying structure arrays has changed in 3.1.
>> | Now, I get this:
>> |
>> | octave> x = 1:10;
>> | octave> N = length(x);
>> |
>> | octave> y = repmat(struct('field1',[],'field2',[]),1,N)
>> | y =
>> | {
>> | 1x10 struct array containing the fields:
>> |
>> | field1
>> | field2
>> | }
>> |
>> | I think that this behaviour is due to this change:
>> |
>> | 2008-03-07 John W. Eaton <address@hidden>
>> |
>> | * ov-struct.cc (octave_struct::print_raw): Don't print contents fo
>> | struct arrays that have more than one element.
>> |
>> |
>> | How can I see the fields' contents all at once?
>>
>> If you think the behavior in the development version is bad, then I
>> think we should discuss what it should do on the maintainers list.
>
> In fact, I think it is better than before, as a default. However, there
> are times I would like to have a quick look at the whole contents of the
> struct array (for small ones, at least).
>
> Maybe disp() could behave differently and show everything? Or there
> could be a function controlling the printout, in the spirit of
> struct_levels_to_print() ?
>
Currently, I am updating the documentation for container types. Due to the above
change in displaying structure arrays, many of the examples for structure arrays
in doc/interpreter/container.txi can no longer be reproduced with the current
development version of octave. And, indeed, I find it quite difficult to produce
good examples to explain structure arrays without a way to display the content
of a complete structure.
Overall, we have this display behaviour for the container types in octave:
- structures can be printed up to a certain level controlled by the
struct_levels_to_print function
- cell arrays are always shown fully (as far as I know)
- structure arrays are only shown to the first level (i.e. field names) now
Actually, I would vote for a consistent way to control the display depth in all
three cases. So what do you think about this:
We replace the struct_levels_to_print function (and internal variable) by a
levels_to_print function that controls the printing depth in all three cases?
regards
Thorsten
- Re: displaying structure arrays,
Thorsten Meyer <=