plot templates and options lists for set, plot etc.

Ben Abbott bpabbott at mac.com
Sun Jul 5 15:39:29 CDT 2009


On Jul 5, 2009, at 3:01 PM, Thorsten Meyer wrote:

> Hi,
>
> thanks a lot for the quick response.
>
> Ben Abbott wrote:
>>
>> On Jul 5, 2009, at 7:23 AM, Thorsten Meyer wrote:
>>
>>> Hi,
>>>>
>>>> I'm running Matlab 2009a
>>>>
>>>> x = 0:0.01:5;
>>>> h(1) = line (x, sin(x));
>>>> h(2) = line (x, cos(x));
>>>> s(1,1).Color = 'red';
>>>> s(1,2).Color = 'green';
>>>> set (h, s);
>>>> color = get (h, 'color');
>>>> color{:}
>>>> ans =
>>>>    0     1     0
>>>> ans =
>>>>    0     1     0
>>>>
>>>> I'd expected the lines to have different colors.
>>> Could you also try
>>>   h(1) = line (x, sin(x));
>>>   h(2) = line (x, cos(x));
>>>   s(1,1).Color = 'red';
>>>   s(2,1).Color = 'green';
>>>   set (h, s);
>>>   color = get (h, 'color');
>>>   color{:}
>>> ?
>>
>> My usual computer is in for repair. My second machine is PPC based  
>> and
>> is only able to run Matlab R2007b. I had to add the 3rd line below to
>> run your script, but the results are not correct.
>>
>>>> h(1) = line (x, sin(x));
>>>> h(2) = line (x, cos(x));
>>>> s = struct ();
>>>> s(1,1).Color = 'red';
>>>> s(2,1).Color = 'green';
>>>> set (h, s);
>>>> color = get (h, 'color');
>>>> color{:}
>>>> ans =
>>     0     1     0
>>>> ans =
>>     0     1     0
>>
> So, matlab sets all elements of the properties structure for each of  
> the
> handles in h independent of the dimensions of the structure (unless  
> they
> have changed it in the 2009 version). Or, nicer to implement: it sets
> the values found in the last elements of the struct array fields.

I believe Matlab sets each in property name/value pair for all objects.

As the property names may be different, it will be necessary to  
determine the last instance of each unique property name to avoid  
setting all the property name/value pairs.

Ben


More information about the Octave-maintainers mailing list