From owner-help-octave at bevo dot che dot wisc dot edu Fri Nov 15 18:30:55 1996 Subject: "plot" within function def From: "John W. Eaton" To: Ted dot Harding at nessie dot mcc dot ac dot uk (Ted Harding) Cc: help-octave at bevo dot che dot wisc dot edu Date: Fri, 15 Nov 1996 18:30:25 -0600 On 15-Nov-1996, Ted Harding wrote: : I don't know if this is a bug: I can only describe the behaviour. : The following is a file: call it "test.m"; its purpose is to define a : function "config". It is probably a bug in something, but I'm not sure what. : Now for the fun bit. : : 1. Start octave from scratch. : 2. Do "test" to read in the above file. : 3. Do "config". : You will see ONLY ONE TRIANGLE (the first). : 4. Do "config" again. : You will now see TWO TRIANGLES, as intended. And the same for every : repetition. : 5. Quit octave. : : Next, edit "test.m" so as to uncomment the line "plot([0 1],[0 1])". : Then repeat the above. NOW YOU WILL SEE TWO TRIANGLES FIRST TIME, as : intended. : : It therefore seems that the "plot" command, when it occurs inside a : function definition as above, must first be "primed" by being executed : before the the function is called. : : There it is: any comments? I was able to observe this behavior, but I got inconsistent results. After poking around for a while, it seems that the strings that are sent to the plotter stream are ok, and that they are being flushed, so I don't know why the display is not always updated. Anyway, here is a patch that seems to work around the problem, whatever it really is. *** scripts/plot/plot_int.m~ Sun Oct 8 23:26:11 1995 --- scripts/plot/plot_int.m Fri Nov 15 18:24:40 1996 *************** *** 81,86 **** --- 81,88 ---- endif endif + replot; + unwind_protect_cleanup if (! hold_state) Hmm, jwe