octave-maintainers
[Top][All Lists]
Advanced

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

Re: plot templates and options lists for set, plot etc.


From: Ben Abbott
Subject: Re: plot templates and options lists for set, plot etc.
Date: Sun, 05 Jul 2009 16:39:29 -0400


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


reply via email to

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