[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: plot templates and options lists for set, plot etc.
From: |
Thorsten Meyer |
Subject: |
Re: plot templates and options lists for set, plot etc. |
Date: |
Mon, 22 Jun 2009 23:37:47 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
John W. Eaton wrote:
> On 7-Jun-2009, Ben Abbott wrote:
>
> | On Jun 7, 2009, at 8:46 AM, John W. Eaton wrote:
> |
> | > When the graphics property classes were written, it seemed easier to
> | > simply return the internal data as a structure instead of writing
> | > special code to print it.
> |
> | Matlab returns a structure for both p=get(h) and p=set(h). If
> | nargout==0 then lists are printed.
> |
> | The set(h) functionality can be useful in that is displays the default
> | values for each properties (where defaults exist).
>
> OK. I now see that Matlab's documentation also says that set can be
> called with
>
> set (h, struct)
>
> with the structure specifying property names and values, and
>
> set (h, property_names, property_values)
>
> with the property names and values specified as cell arrays. The
> property names cell array is supposed to be a 1xN cell array, but
> since H may be a vector of handles (presumably all corresponding to
> the same type of graphics object), property_names may be an MxN array
> of values, with M == length (H).
>
> So it would be great to have a patch that implements these features.
> To answer Thorsten's earlier question about where the dispatching
> should happen, I suppose it makes sense for the graphics_object::set
> function to be the one to dispatch on the types of the arguments.
>
I have come quite far in implementing the struct case and the 1XN cell
array case in graphics_object::set. However, for the MxN cell array
case, I am not sure what to do:
should the MxN case be dealt with in DEFUN set, extracting the rows out
of property_values and passing them to the set method of the
corresponding graphics objects?
or
should a special input argument be added to the set method (or a new
set_n method) which allows to select a row of the passed property_values?
Also, for the struct case: what does matlab do in case h is a vector of
handles and struct is a struct array? Does it deal the elements of the
struct array to the elements of h? I.e. is set(h,struct) equivalent to
set(h(1), struct(1)); set(h(2), struct(2)); ...? The matlab
documentation isn't clear about this.
thanks and regards
Thorsten