From bug-octave-request at bevo dot che dot wisc dot edu Thu Feb 19 09:36:48 1998 Subject: range input to scripts From: fabian at olymp dot Umwelt dot TU-Cottbus dot de (Rolf Fabian) To: bug-octave at bevo dot che dot wisc dot edu Date: Thu, 19 Feb 1998 16:37:28 +0100 Dear John W., the following problem occurred while doing intense work /w octave on cygwin32 -platforms. But it seems, that it originates from general octave-features: We're tired of typing things like octave> gset xrange [[ 10:30 []; replot to the octave-command line under cygwin32. Note: all square brackets as well as backslashes etc ... must be preceeded by a left square bracket on this platform terminal!. Hence we've written a shorthand-script 'zox.m' (zoom-x-scale without changing y-scale), which has 2 input modes, see below. a) Only the mode mentioned first works, the other where input is a range does not! e.g. octave> zox(1:7) error: invalid vector index = 7 error: evaluating index expression near line XXX column .. error: ..... WHY ?, because index = 7 is obviously a valid index of vector-input x=1:7 #----------- CUT HERE ------------------- ##usage: zox(x0,x1) or zox(x0:x1) ## ##zoom gnuplot x-scale to [x0:x1] and replot ## ##see also: zoy (to be developped) ##author: fabian at umwelt dot tu-cottbus dot de 980218 function zox(x0,x1) if (nargin !=2) if (nargin==1 && is_vector(x0)) #if x0 is range or vector: use only first/last element x0 = x0(1); x1 = x0(length(x)); # <-- XXX else fprintf(stderr,"usage: zox(x0,x1) or zox(x0:x1)\n");return; endif endif axis([x0,x1]); replot; endfunction #----------- CUT HERE ------------------- b) We've tried to develop a corresponding counterpart 'zoy.m' (zoom-y-scale without changing x-scale), but didn't succeed, because we don't see a way to get the current x-scale status (displayed by 'gshow xscale') into a variable, which might be transferred to 'axis([x0,x1,y0,y1])'. Do you see a way to accomplish that? REM: IN THE MEANTIME, WE'VE LEARNED FROM THE COMMENTS IN THE SCRIPTS INSIDE FOLDER 'PLOT', THAT STATUS-REPORTS OF GNULPLOT's SET-PARAMETERS SEEMS TO BE IS A MORE GENERAL PROBELM. Hence forget question b). Best wishes Rolf Fabian 980219 fabian at umwelt dot tu-cottbus dot de