5.1 Output functions
Before delving into the details of the functions for drawing measured
data into the main display window a short explanation of the basic
ideas probably is in order. There are two ways of displaying data. If
only one parameter gets changed during the experiment (e.g. just the
magnetic field gets sweeped) a 1D-display will be all you need. But if
you do measurements where two parameters get changed (e..g. if you
measure time traces of your signal after laser excitation at different
field positions) you will need a 2D-display to view all measured data.
Finally, there can be situations where you need both ways to display
your data. Thus, fsc2
allows you to select either 1D-display,
2D-display or even both at once at the same time. You just have to
tell the program in the PREPARATIONS
section by calling the
functions init_1d()
and init_2d()
. If both
function are invoked in the PREPARATIONS
section two windows
will be displayed, one for the 1D-data and one for the 2D-data.
In 1D-display to display a new data point you have to specify the x-
and the y-coordinate of the point. The x-coordinate is always an
integer number, where 1
indicates the left-most point
(x-coordinates smaller than 1
aren't allowed). As the
y-coordinate usually the measured value is specified. To be able to
draw a meaningful x-axis the program needs another piece of
information: the starting point of the x-axis and the difference
between two adjacent points drawn along the x-axis. For example, if
you do an cw-EPR experiment, starting with a field of 3400 G and a
spacing of 0.5 G between the data points you will have to tell the
program about this in the graphics initialization. If you now specify,
when drawing a new point, an x-coordinate of 11
the point
will appear at an axis position of 3410 G because the point numbered
1
is drawn at 3400 G, the point numbered 2
at
3400.5 G etc., so the point numbered 11
will appear at
3410 G.
In contrast, for a 2D-display you have to specify three coordinates for
a new data point. Here both the x- and y-coordinate are
integers, both starting at 1
. The point with both the x- and
y-coordinate set to 1
is at lower left-and corner of the
display (and x- and y-coordinates with values smaller than 1
aren't allowed). The third coordinate is the measured value, which usually
will be a floating point number. As in the case of 1D-displays also for
2D-display the program needs additional information to be able to draw
meaningful axis. Here not only the starting point and increment for the
x-axis must be given but also corresponding values for the y-axis.
Another point to be kept in mind: if you have not only one data point to draw but a whole 1D-array (or in the case of 2D-display even a 2D-array, i.e. a complete "picture") you can do this without having to draw each point on its own. The functions for drawing also let you specify a whole array. The data from the array are drawn so that the first data point of the array appears at the x-coordinate you specified, and the following points further to the right of it. In case of 2D-arrays the x- and y-coordinate specifies the lower left hand corner of where the 2D-array will be drawn.
Finally, for 1D-display also another display mode is available where new data are always drawn automatically to the right of already displayed points and where the whole set of already drawn points is shifted to the left (and out of the viewable area when the new data points wouldn't fit into the display window anymore). Thus in this "sliding display" mode no automatic scaling in horizontal direction happens, old data are simply discarded when they don't fit into the display window anymore.
List of all output functions:
- `init_1d()'
- `init_2d()'
- `display_1d()'
- `display_2d()'
- `display()'
- `display_mode()'
- `change_scale_1d()'
- `change_scale_2d()'
- `change_scale()'
- `vert_rescale_1d()'
- `vert_rescale_2d()'
- `vert_rescale()'
- `change_label_1d()'
- `change_label_2d()'
- `change_label()'
- `rescale_1d()'
- `rescale_2d()'
- `rescale()'
- `zoom_1d()'
- `zoom_2d()'
- `zoom()'
- `clear_curve_1d()'
- `clear_curve_2d()'
- `clear_curve()'
- `draw_marker_1d()'
- `draw_marker_2d()'
- `draw_marker()'
- `clear_marker_1d()'
- `clear_marker_2d()'
- `clear_marker()'
- `curve_button_1d()'
- `curve_button_2d()'
- `curve_button()'
- `fs_button_1d()'
- `fs_button_2d()'
- `fs_button()'
- `print()'
- `show_message()'
Descriptions of output functions:
- `init_1d()'
This function initializes the display for one-dimensional data representation - without a call to this function (or
init_2d()
, see below) no data can be displayed. The function may only be called once and accepts up to six arguments, all of them being optional. These are:- The number of curves to be displayed, the maximum is currently 4 curves. If not given it defaults to 1.
-
The number of points, if missing, zero or negative it will be treated as
unknown and default to 32 points. If the specified value (or the default
value) turns out to be too small it is adjusted automatically in the
experiment so that all data again will fit into the display (as long as
the
FS
(Full Scale) button is switched on). -
Start value of the x-axis. If missing (or undefined, see next point)
point numbers are printed, starting with
1
. - Increment for data along the x-axis (thus restricting the display to equally spaced data). Setting it to zero implies that the start value and the increment are undefined and point numbers are shown instead. Negative increments are handled correctly.
- A string variable with the label to be shown at the x-axis.
- A string variable with the label to be shown at the y-axis.
Formally, the function with its arguments can be written as
init_1d( [ n_curves [ , n_points [ , start, increment ] ], ] [ x_label [ , y_label ] ] )
This means that the function can be called in all of the following ways:
init_1d( n_curves, n_points, start, increment, x_label, y_label ) init_1d( n_curves, n_points, start, increment, x_label ) init_1d( n_curves, n_points, x_label, y_label ) init_1d( n_curves, n_points, x_label ) init_1d( n_curves, n_points ) init_1d( n_curves, x_label, y_label ) init_1d( n_curves, x_label ) init_1d( n_curves ) init_1d( x_label, y_label ) init_1d( x_label ) init_1d( )
In error messages the start value and the increment of the data displayed at the x-axis are (in contrast to the point numbers) referred to as `real world coordinates'.
This function can only be used in the
PREPARATIONS
section of anEDL
script.- `init_2d()'
The function initializes the display for two-dimensional data representation. The function may only be called once and accepts up to nine arguments, all of them optional. The arguments are:
- Number of data sets to be displayed, maximum is currently 4. If not given it defaults to 1.
- Number of points in x-direction, if missing or less than 1 it will be treated as unknown and default to 16. If the specified value (or the default value) turns out to be too small it is adjusted automatically in the experiment so that all data fit into the display.
-
Number of points in y-direction, if missing or less than 1 it will
be treated as unknown and default to 16. If the specified or the default
value turns out to be too small it is adjusted automatically in the
experiment so that all data fit into the display (at least as long as
the
FS
(Full Scale) button is switched on). -
Start value of the x-axis. If missing (or undefined, see also next
entry) point numbers are printed, starting with
1
. - Increment for data along the x-axis (thus restricting the display to equally spaced data). Setting it to zero implies that the start value and the increment are undefined and point numbers are shown instead.
- Start value of the y-axis. The same rules as for the x-axis apply for missing or undefined values.
- Increment for data along the y-axis. The same rules as for the x-axis apply for missing values or when zero is specified.
- String variable with label to be shown at the x-axis.
- String variable with label to be shown at the yaxis.
- String variable with label to be shown at the z-axis.
Formally, the function with its arguments can be written as
init_2d( [ n_data_sets [ , n_x_points [ , n_y_points, [ , x-start, x-increment, y-start, y-increment ] , ] ] ] [ x-label [ , y-label [ , z-label ] ] ] )
This function can only be used in the
PREPARATIONS
section of anEDL
script.- `display_1d()'
This function is used called to draw data in the window for 1D-data. It takes the following arguments:
-
The (x) point number (coordinate) where the data point (if only a
single number is given as the third argument) or the coordinate where
the first data point of an data array passed as the third argument is to
be shown.
Please note: in "sliding window" display mode this first argument won't be used at all (but it must be given and must be larger than
0
), new data will always be appended to the right side of the display. I.e. in "sliding window" display mode you have no direct control about where the data will be displayed. - The data point or a (one-dimensional) array of data (to be displayed left to right).
-
Number of the curve or data set the data are to be displayed belong
to. If missing it defaults to the first curve, 1. If there is more
than one data set given in the
display()
command the curve number must be specified.
These arguments can be repeated as many times as there are data to be displayed simultaneously (but in this case all of the arguments must be specified!).
Formally, the function with its arguments can be written as
display( n_x_point, data [ , n_curve [ , ... ] ] )
When the display mode (display_mode()) is set to
SLIDING DISPLAY
the x-coordinate has no function at all (but must be given and must be larger than0
), new data points are always appended to the right of the already drawn data points.This function can only be used in the
EXPERIMENT
section of anEDL
script.-
The (x) point number (coordinate) where the data point (if only a
single number is given as the third argument) or the coordinate where
the first data point of an data array passed as the third argument is to
be shown.
- `display_2d()'
This function is used called to draw data in the window for 2D-data. experiments. It takes the following arguments:
- The (x) point number (coordinate) where the data point (if only a single number is given as the third argument) or the coordinate where the first data point of an data array passed as the third argument is to be shown.
- The y-point number (coordinate) of the data point or the coordinate for the first data point of an data array (arrays are always drawn to the right from the specified coordinate, i.e. in x-direction).
- The data point or a 1-dimensional or 2-dimensional array of data. If a 2-dimensional array is passed to the function, the first sub-array is drawn at the coordinates passed to the function, while for each of the following sub-arrays the y-point is incremented by 1. Not yet defined sub-arrays are skipped (but the y-position is incremented), at the row where this (undefined) sub-array would have appeared nothing is drawn.
-
Number of the curve or data set the data are to be displayed belong
to. If missing it defaults to the first curve, 1. If there is more
than one data set given in the
display()
command the curve number must be specified.
These arguments can be repeated as many times as there are data to be displayed simultaneously (but in this case all of the arguments must be specified!).
Formally, the function with its arguments can be written as
display( n_x_point, n_y_point, data [ , n_curve [ , ... ] ] )
This function can only be used in the
EXPERIMENT
section of anEDL
script.- `display()'
This function can be used instead of either
display_1d()
ordisplay_2d()
if eitherinit_1d()
orinit_2d()
(but not both) were called in thePREPARATIONS
section. It takes the following arguments:- The (x) point number (coordinate) where the data point (if only a single number is given as the third argument) or the coordinate where the first data point of an data array passed as the third argument is to be shown.
- Only for 2D-display: The y-point number (coordinate) of the data point or the coordinate for the first data point of an data array (arrays are always drawn to the right from the specified coordinate, i.e. in x-direction).
- The data point or a (one-dimensional) array of data.
-
Number of the curve or data set the data are to be displayed belong
to. If missing it defaults to the first curve, 1. If there is more
than one data set given in the
display()
command the curve number must be specified.
These arguments can be repeated as many times as there are data to be displayed simultaneously (but in this case all of the arguments must be specified!).
This function can only be used in the
EXPERIMENT
section of anEDL
script.- `display_mode()'
Beside the normal display mode, where data get rescaled automatically to fit onto the 1D display window (at least as long as the
FS
(Full Scale) button is switched on), there's also a second display mode, where a rescaling is done for the y-direction only. In this mode, when the new data wouldn't fit into the display window anymore, the whole data set is shifted to the left to make room for the new data, and some of the old data vanish.To switch between the normal display mode and the "sliding window" display mode the function
display_mode()
has to be used. The function expects at least one argument, the mode to be used. You have to specify the string"NORMAL_DISPLAY"
(or"NORMAL"
or simply the number0
) to switch to the normal display mode (which is the default mode to be used) and the string"SLIDING_DISPLAY"
(or"SLIDING"
or the number1
) to switch to "sliding window" mode.The second, optional argument is the number of points to display in x-direction. If this argument isn't specified the previous number of already displayed points will be used (but at least 32).
When the function gets called all previously displayed data will be cleared from the screen as well as all markers possibly shown. The scaling in y-directions remains unchanged.
This function can be used in both the
PREPARATIONS
as well as theEXPERIMENT
section of anEDL
script.- `change_scale_1d()'
This function allows to change the scale settings of the 1D-data window (originally set in the call of
init_1d()
) after an experiment has been started. The function can be passed a maximum of two arguments, the new start value of the x-axis and the new x-increment.If one of these values should remain unchanged a string (e.g."keep"
) instead of a value can be passed as the argument.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `change_scale_2d()'
This function allows to change the scale settings of the 2D-data window (originally set in the call of
init_2d()
) after an experiment has been started. The function accepts up to four arguments, the new start value of the x-axis, the new x-increment, a new start value for the y-axis as well as the y-increment. If one of these values should remain unchanged a string (e.g."keep"
) instead of a value can be passed as the argument.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `change_scale()'
This function allows to change the scale settings (originally set in the call of
init_1d()
orinit_2d()
) when your using either a 1D-display or a 2D-display (but not both) after the experiment has been started. With a one-dimensional display the function can be passed a maximum of two arguments, the new start value of the x-axis and the new x-increment. For two-dimensional display the function also accepts a new start value for the y-axis as well as the y-increment. If one of these values should remain unchanged a string (e.g."keep"
) instead of a value can be passed as the argument.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `vert_rescale_1d()'
The function allows to resize the y-scaling of the display so that all curves will again fit vertically into the display area (the horizontal scaling is left unchanged). The function takes no arguments.
This function can only be used in the
EXPERIMENT
section of anEDL
script.- `vert_rescale_2d()'
The function allows to resize the z-scaling of the display so that currently displayed curve will use the full range of z-values again. The function takes no arguments.
This function can only be used in the
EXPERIMENT
section of anEDL
script.- `vert_rescale()'
The function allows to change the vertical scaling for 1D-display or the z-scaling for 2D-display when only either 1D or 2D display is activated. If both are active use the function
vert_rescale_1d()
to change the vertical scaling of the 1D display andvert_rescale_2d()
to change the z-scaling of the 2D display.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `change_label_1d()'
Using this function the labels at the axis of the 1D-display window can be changed from within as
EDL
script. It accepts up to two strings for the x- and y-axis labels. To leave a label unchanged pass the function an empty string, i.e.""
. If no label should be drawn pass it a string that just contains one (or more) space characters, i.e." "
.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `change_label_2d()'
Using this function the labels at the axis of the 2D-display window (and, if shown, of the cross section window) can be changed from within as
EDL
script. It accepts up to three strings for the x-, y-axis and z-axis label. To leave a label unchanged pass the function an empty string, i.e.""
. If no label should be drawn pass it a string that just contains one (or more) space characters, i.e." "
.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `change_label()'
Using this function the labels at the axis of the display window (and, if shown, of the cross section window) can be changed from within as
EDL
script when only either the 1D- or the 2D-display window is used (but not both). For 1D-display it accepts up to two strings for the x- and y-axis labels, for 2D-display up to three, the third for the z-axis label. To leave a label unchanged pass the function an empty string, i.e.""
. If no label should be drawn pass it a string that just contains one (or more) space characters, i.e." "
.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `rescale_1d()'
In the function
init_1d()
the number of points in x-direction can be set. If, during the experiment more points are displayed then set in the initialization, the scaling of the axis will be changed automatically. Using the functionrescale()
one can change the number of points from within theEDL
script. The function accepts one argument, the new number of points in x-direction. A negative number is silently ignored. For a value of0
the number of points is adjusted to the number of currently displayed points. A value of1
will be increased to the lowest number of points that can be displayed, which is2
. If the number is smaller than the number of currently displayed points it is automatically increased to this number.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `rescale_2d()'
In the function
init_2d()
the number of points in x- and y- direction can be set. If, during the experiment more points are displayed than had been set in the initialization, the scaling of the axes will be changed automatically. Using the functionrescale()
one can change the number of points from within theEDL
script. The function accepts two arguments, the first being the number of points to be displayed in x-direction and the second the number of points in y-direction.A negative number is silently ignored. For a value of
0
the number of points is adjusted to the number of currently displayed points in that direction. A value of1
will be increased to the lowest number of points that can be displayed, which is2
. If the number is smaller than the number of currently displayed points it is automatically increased to this number.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `rescale()'
This function can be called instead of
rescale_1d()
orrescale_2d()
when only either a 1D- or a 2D-display is used (but not both at once). In the 1D-case the function accepts one argument, the new number of points in x-direction. In the 2D-case the function accepts two arguments, one for the number of points to be displayed in x-direction and the second for the number of points in y-direction.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `zoom_1d()'
This function can be used to zoom into (or out of) the 1D display window as well as shifting the contents of the window, just like you can do using the mouse. It expects at least one and up to four arguments. The first one is either the point number of the point to show at the leftmost position in the window. The second is the number of points to be shown within the 1D window. The third value is the smallest y-value still to be shown in the 1D window. The fourth and last optional argument is the span of y-values to show in the 1D window. The number of points to be shown in x-direction must be larger than
1
and the y-span must be larger than0
. If an argument is not given or is given as an arbitrary string (e.g."KEEP"
) the corresponding value remains unchanged.The function returns the value
1
to indicate success or0
if it is impossible to set the zoom (since no scaling has been set for the 1D window yet).This function can only be used in the
EXPERIMENT
section of anEDL
script.- `zoom_2d()'
This function can be used to zoom into (or out of) the 2D display window as well as shifting the contents of the window, just like you can do using the mouse. It expects at least two and up to seven arguments. The first one is the number of the curve to be zoomed. This must be a number between
1
and the maximum curve number (as set by the call ofinit_2d()
). The second and third argument are the x-coordinate of the leftmost point to be displayed within the 2D window and the number of points to be displayed in x-direction. The fourth and fifth argument are the y-coordinate of the point with the smallest y-value and the number of points to be displayed. The sixth and seventh argument determine the z-range to be displayed, the sixth argument being the lowest-valued z-value and the last argument the z-span. Both the number of points in x- and y-direction must be numbers larger than1
and the z-span larger than0
. If an argument is not given or is given as an arbitrary string (e.g."KEEP"
) the corresponding value remains unchanged.The function returns the value
1
to indicate success or0
if it is impossible to set the zoom (since no scaling has been set for the 1D window yet).This function can only be used in the
EXPERIMENT
section of anEDL
script.- `zoom()'
This function can be called instead of
zoom_1d()
orzoom_2d()
when only either a 1D- or a 2D-display is used (but not both at once). In the 1D-case the function must be called with at least two and up to four arguments, in the 2D case with at least two and a maximum of seven arguments.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `clear_curve_1d()'
Removes one or more curves from the 1d-display. As many curve numbers as there are curves displayed can be passed to the function as arguments. No arguments at all implies the first curve only. Invalid arguments are discarded and an error message is printed.
This function can only be used in the
EXPERIMENT
section of anEDL
script.- `clear_curve_2d()'
Removes one or more curves from the 2D-display. As many curve numbers as there are 2D-curves displayed can be used. No arguments at all implies the first curve only. Invalid arguments are discarded and an error message is printed.
This function can only be used in the
EXPERIMENT
section of anEDL
script.- `clear_curve()'
If there is only either a 1D- or 2D-display window this function can be used instead of
clear_curve_1d()
orclear_curve_2d()
.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `draw_marker_1d()'
This function can be used for 1D graphics and draws a vertical dashed line on the display window. It expects at least one argument, an integer number defining the x-position of the marker to be drawn. A second, optional argument is the color of the marker, here one may specify either an integer number or a string:
Number String Color 0
"WHITE"
white 1
"RED"
red 2
"GREEN"
green 3
"YELLOW"
yellow 4
"BLUE"
blue 5
"BLACK"
black 6
"DELETE"
The last color,
"DELETE"
, is obviously not a color but can be used to delete a marker at the specified position (if more than one marker has been set for that position only the first, older one will be deleted).Please note: in "sliding window" display mode, the coordinate for the marker is not used at all (but must be given and must be larger than
0
), the marker will always be drawn at the newest point for the first displayed curve (the curve numbered 1). Thus also can't delete a single marker in this mode but only all of them using the functionclear_marker_1d()
.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `draw_marker_2d()'
This function can be used for 2D graphics and draws a box in the display window. It expects at least two arguments, integer numbers defining the x- and y-position of the marker to be drawn. As a third argument the curve number can be specified - if it is missing or as the value
0
the marker is drawn over the currently displayed curve. The fourth (optional) argument is the color of the marker, here one may specify either an integer number or a string:Number String Color 0
"WHITE"
white 1
"RED"
red 2
"GREEN"
green 3
"YELLOW"
yellow 4
"BLUE"
blue 5
"BLACK"
black 6
"DELETE"
black The last color,
"DELETE"
, is invisible obviously not a color but can be used to delete a marker at the specified position (if more than one marker has been set for that position only the first, older one will be deleted).This function can only be used in the
EXPERIMENT
section of anEDL
script.- `draw_marker()'
This function can be called instead of
draw_marker_1d()
ordraw_marker_2d()
when only either a 1D- or a 2D-display is used (but not both at once).This function can only be used in the
EXPERIMENT
section of anEDL
script.- `clear_marker_1d()'
This function deletes all previously set 1D markers. It accepts no arguments.
This function can only be used in the
EXPERIMENT
section of anEDL
script.- `clear_marker_2d()'
When invoked without any arguments at all this function deletes all previously set 2D markers on all curves. Otherwise it expects a list of curve numbers and deletes only all markers on these curves.
This function can only be used in the
EXPERIMENT
section of anEDL
script.- `clear_marker()'
This function can be called instead of
clear_marker_1d()
orclear_marker_2d()
when only either a 1D- or a 2D-display is used (but not both at once).This function can only be used in the
EXPERIMENT
section of anEDL
script.- `curve_button_1d()'
If invoked with a single argument, a number between
1
and the maximum number of curves displayed in the 1D display window, it returns0
if the button for that curve (at the upper left hand side of the 1D display window) is switched off (i.e. the curve is exempt from rescaling operations) and1
if its on. If called with a second, boolean argument (i.e. either a string,"ON"
or"OFF"
, or a number with0
standing for off and a non-zero number for on), the state of the button for the curve is changed accordingly.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `curve_button_2d()'
If invoked with no argument the number of the currently displayed 2D curve (i.e. a number between
1
and the maximum number of curves displayed in the 2D display window) is returned, or0
if no curve is displayed at the moment.If invoked with a single argument, a number between
1
and the maximum number of curves displayed in the 2D display window, it returns0
if the button for that curve (at the upper left hand side of the 1D display window) is switched off (i.e. the curve is not shown) and1
if the curve is currently shown.If called with a second, boolean argument (i.e. either a string,
"ON"
or"OFF"
, or a number with0
standing for off and a non-zero number for on), the state of the button for the curve is changed accordingly.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `curve_button()'
This function can be called instead of
curve_button_1d()
orcurve_button_2d()
when only either a 1D- or a 2D-display is used (but not both at once).This function can only be used in the
EXPERIMENT
section of anEDL
script.- `fs_button_1d()'
If invoked without an argument the function returns
1
if theFS
(Full Scale) button is switched on (automatic rescaling is enabled) and0
if it's switched off. If called with a boolean argument (i.e. either a string,"ON"
or"OFF"
, or a number with0
standing for off and a non-zero number for on), the state of the button is changed accordingly and automatic rescaling enabled or disabled.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `fs_button_2d()'
If invoked with a single argument, a number between
1
and the maximum number of curves displayed in the 2D display window, it returns1
if theFS
(Full Scale) button for that curve is switched on (i.e. the curve will be rescaled automatically) and0
if theFS
button for the curve is switched off.If called with a second, boolean argument (i.e. either a string,
"ON"
or"OFF"
, or a number with0
standing for off and a non-zero number for on), the state of theFS
button for the curve designated by the first argument is changed accordingly and automatic rescaling is enabled or disabled.This function can only be used in the
EXPERIMENT
section of anEDL
script.- `fs_button()'
This function can be called instead of
fs_button_1d()
orfs_button_2d()
when only either a 1D- or a 2D-display is used (but not both at once).This function can only be used in the
EXPERIMENT
section of anEDL
script.- `print()'
This function prints text into the output browser in the main form of
fsc2
. It needs a format string as its very first argument. The format string can contain any text as well as a special character,#
, that works as a placeholder for data to be printed in its place. Here's a first simple example: You want to print the value of a variable calledI
, that has been assigned a value of 3. Now,print( "The value of I is #.\n", I );
will print, when the script is interpreted,
The value of I is 3.
But you can have not only one but as many placeholder characters in the format string as you need. Of course, the number of placeholder characters has to match the number of variables (or data) following the format string. If the number of
#
's and the number of variables to be printed doesn't fit a warning is printed. If there are too many#
's the superfluous ones are simply printed out, but if there are not enough only as many variables as there are#
's are printed, the remaining data are discarded.You may use
print()
to print integer or floating point values (that includes the return values of functions) and variables and strings (i.e. text enclosed in double quotes,"
). Here's a longer, somewhat contrived example:print( "The # of # is #\n", "sine", x, sin( x ) );
This will print (assuming
x
equals0.5
):The sine of 0.500000 is 0.479426
There are special sequences allowed in the format string. They all start with an escape character, the backslash
\
. Here's a list of all recognized special sequences:- `\n'
Linefeed character: Ends a line, everything following it starts on a new line. Thus several lines can be printed at once by one call of
print()
.print()
does not automatically add a linefeed by itself.- `\t'
Embeds a tabulator character in the text, tab stops are set at every eighth character position.
- `\\'
Prints a backslash,
\
, thus switching off the special meaning of the backslash as an escape character.- `\"'
Prints a quote - use it to embed quotes into the format string.
- `\#'
Prints a
#
, thus switching off the special meaning of the#
character as a placeholder for variables to be printed.- `\T'
While normally nothing is printed during the test run of the
EXPERIMENT
section of anEDL
script, if the format string starts with this escape sequence theprint()
function will produce output already in the test run (theT
is never printed).
- `show_message()'
The function allows to display a message in a new window. The user has to click onto the "Ok" button in this window before the function returns, i.e. the experiment is paused while the message is shown.
The function accepts a single argument, a string with the message to be displayed. To display a multi-line message embed '
\n
' characters in the string. Other escape sequences recognized by the function are: '\t
' for a tabulator character, '\\
' or the backslash character (a single backslash is always supposed to start an escape sequence) and '\"
' to embed double quotes in the message.Avoid messages with more than 6 lines, they won't fit into the message box.
This document was generated by Jens Thoms Toerring on September 6, 2017 using texi2html 1.82.