<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2008 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>Reread</TITLE> <META NAME="description" CONTENT="Reread"> <META NAME="keywords" CONTENT="gnuplot"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2008"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="gnuplot.css"> <LINK REL="next" HREF="node173.html"> <LINK REL="previous" HREF="node171.html"> <LINK REL="up" HREF="node88.html"> <LINK REL="next" HREF="node173.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html3543" HREF="node173.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html3537" HREF="node88.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html3531" HREF="node171.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html3539" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html3541" HREF="node467.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html3544" HREF="node173.html">Reset</A> <B> Up:</B> <A NAME="tex2html3538" HREF="node88.html">Commands</A> <B> Previous:</B> <A NAME="tex2html3532" HREF="node171.html">Replot</A> <B> <A NAME="tex2html3540" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html3542" HREF="node467.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION040210000000000000000"></A> <A NAME="commands_reread"></A><A NAME="reread"></A><A NAME="3670"></A> <BR> Reread </H1> The <B>reread</B> command causes the current <B>gnuplot</B> command file, as specified by a <B>load</B> command or on the command line, to be reset to its starting point before further commands are read from it. This essentially implements an endless loop of the commands from the beginning of the command file to the <B>reread</B> command. (But this is not necessarily a disaster -- <B>reread</B> can be very useful when used in conjunction with <B>if</B>. See <B>if (p. <A HREF="node108.html#if"><IMG ALIGN="BOTTOM" BORDER="1" ALT="[*]" SRC="crossref.png"></A>)<A NAME="3678"></A></B> for details.) The <B>reread</B> command has no effect if input from standard input. <P> Examples: <P> Suppose the file <TT>"</TT>looper<TT>"</TT> contains the commands <BR> <PRE> a=a+1 plot sin(x*a) pause -1 if(a<5) reread </PRE> <BR> and from within <B>gnuplot</B> you submit the commands <BR> <PRE> a=0 load 'looper' </PRE> <BR> The result will be five plots (separated by the <B>pause</B> message). <P> Suppose the file <TT>"</TT>data<TT>"</TT> contains six columns of numbers with a total yrange from 0 to 10; the first is x and the next are five different functions of x. Suppose also that the file <TT>"</TT>plotter<TT>"</TT> contains the commands <BR> <PRE> c_p = c_p+1 plot "$0" using 1:c_p with lines linetype c_p if(c_p < n_p) reread </PRE> <BR> and from within <B>gnuplot</B> you submit the commands <BR> <PRE> n_p=6 c_p=1 unset key set yrange [0:10] set multiplot call 'plotter' 'data' unset multiplot </PRE> <BR> The result is a single graph consisting of five plots. The yrange must be set explicitly to guarantee that the five separate graphs (drawn on top of each other in multiplot mode) will have exactly the same axes. The linetype must be specified; otherwise all the plots would be drawn with the same type. See animate.dem in demo directory for an animated example. <P> <HR> <!--Navigation Panel--> <A NAME="tex2html3543" HREF="node173.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html3537" HREF="node88.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html3531" HREF="node171.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html3539" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html3541" HREF="node467.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html3544" HREF="node173.html">Reset</A> <B> Up:</B> <A NAME="tex2html3538" HREF="node88.html">Commands</A> <B> Previous:</B> <A NAME="tex2html3532" HREF="node171.html">Replot</A> <B> <A NAME="tex2html3540" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html3542" HREF="node467.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> 2010-08-17 </ADDRESS> </BODY> </HTML>