help-octave
[Top][All Lists]
Advanced

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

Assigning Graphics Handles using Variables


From: Jason C. Wells
Subject: Assigning Graphics Handles using Variables
Date: Sat, 06 Aug 2011 13:12:03 -0700
User-agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.13) Gecko/20110120 Lightning/1.0b2 Thunderbird/3.1.7

I am trying to write a bit of octave to do plot setup for me.  Graphics handles are a little confusing to me.  I would like to use an incrementing variable to setup graphic properties for a series of curves.

    numlines=3;
    i=1;
    color={"green", "red", "blue"};
    while (i <= numlines)
       linestr = strcat ( "line", num2str ( i ), "_h" );
       linestr = line;    # <==== this doesn't work, linestr is re-assigned.
       set (linestr, "color", color{i});
       set (linestr, "linewidth", 2);
       ++i;
    endwhile


I would like to have linestr evaluated before setting it equal to the handle returned by line().  That is, I would like to set:

    line1_h = line

not:

    linestr = line

as the above code does.  line1_h is the incrementing variable.

I thought that eval() might help me, but I couldn't figure it out.  I am not a programmer by training.  I won't be surprised if I have missed a trivial point here so feel free to assume a noobish mistake.

Also, what does the number in a graphics handle represent?  If I get() graphics properties, I'll see handles like -4406.21.  As far as I can tell, that number is not meant for human consumption.

Thanks,
Jason C. Wells

reply via email to

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