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: Olaf Till
Subject: Re: Removing disadvantages on struct array and cell struct array?
Date: Sat, 8 Jan 2011 18:15:06 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

On Sat, Jan 08, 2011 at 03:22:51AM -0800, veryhappy wrote:
> 
> I needed to describe some circuits so i made a struct with the fields i
> wanted for each component (all the components have the same fields: type,
> value and print_value) but when i want to put them in an array and assign it
> to the circuit i'd found that i've two possibilities:
> Making a cell struct array or making a struct array.
> The first one has the advantage that when i ask for the content of the
> variable it prints out full information in the form of name and contents of
> each of the components (this is VERY interesting for me) but i think (I may
> be wrong) i'll have a harder work to process them because i'll need to
> create auxiliary functions and use cellfun for almost anything.
> On the other side if i make it a struct array it will be easier to work with
> it but it doesn't print the full contents instead all it does is to print
> 1xsize struct array containing the fields: type value print_value
> Is there a way to overcome any of those disadvantages ,i.e make easier to
> work with a cell struct array  (removing the need to use cellfun most of the
> times) or make the struct array print the full contents instead of a briefly
> description of which fields does it have?

If you want to display the detailed contents of a structure array, you
possibly can use num2cell(your_structure_array).

Olaf


reply via email to

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