Set Column Values

This dialog is activated with the Set Column Values... command from the Table menu or by entering the shortcut Alt-Q. It provides for filling a column with the result of a function evaluation.

The available mathematical functions (assuming you are using the default scripting language, muParser) are listed in the function selector combo-box next to the Add function button. Details of these functions and supported mathematical operators are listed in the muParser section in the chapter on Mathematical Expressions and Scripting. The special function, col(c), is used to access the values of column c, where c is the column's number (as in col(2)) or its name in double quotes (as in col("time")). You can also obtain values from other tables using the tablecol(t,c) function, where t is the table's name in double quotes and c is the column's number or its name in double quotes (example: tablecol("Table1","time")).

The variables i and j can be used to access the current row and column numbers. Similarly, sr and er represent the selected starting and ending row, respectively.

Using Python as scripting language gives you even more possibilities. Not only can you use arbitrary Python code in the function body, but also access other objects within your project. For details, see the section on Python in the chapter on Mathematical Expressions and Scripting. Nevertheless, even though Python allows for a more powerful syntax, it can be quite slow for very large tables. Therefore you might want to use muParser instead, even when Python is set as the default script engine for your current project, Checking the Use built-in muParser option will force the use of muParser as the scripting engine. This greatly increases the speed of the evaluation for single line expressions.

Figure 5-64. The Set Column Values... dialog.

Warning: When you make changes to the values in a table which contains "filled" values, the dependent values are not recomputed unless the Automatically Recalculate Column Values option is checked in the Tables tab of the Preferences dialog. If this option is unchecked, you will have to explicitly tell QtiPlot to recalculate individual cells or whole columns or rows by selecting "Recalculate" from their context menu or by pressing Ctrl-Return.