octave-maintainers
[Top][All Lists]
Advanced

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

displaying structures array as table


From: CdeMills
Subject: displaying structures array as table
Date: Tue, 30 Aug 2011 03:49:14 -0700 (PDT)

Hello,
let start from a trivial example:
a=[]; a(1).a = 1; a(2).a=2;a(1).b=3;a(2).b=4;
print_struct_array_contents(true);
a

=>
a =

  1x2 struct array containing the fields:

    a = 
    {
      [1,1] =  1.0000e+00
      [1,2] =  2.0000e+00
    }

    b = 
    {
      [1,1] =  3.0000e+00
      [1,2] =  4.0000e+00
    }

I would like to have something more matrix-like:
c= [1 2; 3 4]
c =

   1.0000e+00   2.0000e+00
   3.0000e+00   4.0000e+00

Would it be possible to display the structure a as
a =
fmin  1      2
fnext 3      4

The actual behavior is generic: you can mix apples and pears. What I would
like is to concatenate a number of numeric values together in a matrix-like
fashion, but be able to give some signification for each line: the name of
the first should be 'fmin', the name of the second 'fnext', and so on. Added
benefit is that 'a(2).fmin' doesn't need to be rewritten when fields are
added/deleted, while a(2, 1) would change if I decide to insert a line
before the first one.

For my request to work, this implies all fields to be similar. Any interest
in this idea ?

Regards

Pascal
 


--
View this message in context: 
http://octave.1599824.n4.nabble.com/displaying-structures-array-as-table-tp3778402p3778402.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

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