MagicPlot Manual

Plotting and nonlinear fitting software

User Tools

Site Tools


set_column_formula

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
set_column_formula [Thu May 20 20:15:08 2010]
Alexander
set_column_formula [Mon Jan 18 17:35:05 2021]
Alexander
Line 1: Line 1:
-===== Set Column Formula ===== +====== Setting Column Formula ====== 
-Use Table -> Set Column Formula menu item to open column formula dialog window.+=== There are two ways to set formula for column evaluation: ===
  
-See [[formula|formula syntax]].+1. Select column and write formula in formula string.
  
-{{:column_formula.png| Set column formula dialog}}+{{:column-inspector.png?nolink|}} 
 + 
 +2. Use ''Table -> Set Column Formula'' menu item to open column formula dialog window. See [[expressions]] for details. 
 + 
 +{{:column_formula.png?nolink| Set column formula dialog}}
  
 ===== Row Index ===== ===== Row Index =====
-Variable ''i'' contains the current row index.+Variable ''i'' contains the current row index. Rows are enumerated from 1.
  
 ===== Rows Evaluation Order ===== ===== Rows Evaluation Order =====
-Rows are always evaluated one after another from the first to the last in the specified range. Accordingly the row number ''i'' is incremented on each step.+Rows are always evaluated one after another from the first to the last in the specified range. Accordingly the row number ''i'' is incremented after each step.
  
 == Example == == Example ==
-You can use this behaviour to calculate [[wp>factorial]]: set ''1'' in the first row of column ''A'' and after that set formula +  * You can use this behavior to calculate [[wp>factorial]]: set ''1'' in the first row of column ''A'' and after that set formula ''cell(A, i-1) * i'' and rows interval from ''2'' to ''100''. Note that formula is to be set for rows beginning from the second, and not from the first. You will get the factorial of row number (''i'').
-''cell(A, i-1) * i'' and rows interval from ''2'' to ''100''. Note that formula is to be set for rows beginning from the second, and not from the first. You will get the factorial of row number (''i'').+
  
  
 ===== Using Table Data ===== ===== Using Table Data =====
-Only in //Set Column Formula// window. 
- 
 There are two functions to obtain current table cell values in formula: There are two functions to obtain current table cell values in formula:
-  * ''col(A)'' -- returns the value of cell in column 'A' in the current (i-th) row. Equivalent to ''cell(A, i)''.+  * ''col(A)'' -- returns the value of cell in column ''A'' in the current (i-th) row. Equivalent to ''cell(A, i)''.
   * ''cell(A, 3)'' -- returns the value in column ''A'' and row ''3''.   * ''cell(A, 3)'' -- returns the value in column ''A'' and row ''3''.
  
Line 29: Line 30:
   * ''col(A) + 15 + cell(B, i+1)''   * ''col(A) + 15 + cell(B, i+1)''
  
-===== What is "Not-a-Number returned at row #Warning=====+===== Auto Recalculation on Data Change ===== 
 +MagicPlot can automatically recalculate formula when data in used columns are changed. Set ''Auto Recalculate'' checkbox to enable this feature. 
 + 
 +== Example == 
 +  * Set formula ''col(A)*2'' for column B and set ''Auto Recalculate'' checkbox. Column B will be recalculated if you change values in column A or column A is updated by other formula or processing algorithm (e.g. integral, derivative of other column). 
 + 
 +===== Formula Menu in Column Context Menu ===== 
 +You can edit column formula and change auto recalculation mode from column context menu or menu ''Table''. Select exactly one column and open context menu to view this menu items. 
 + 
 +{{:formula_submenu.png?nolink|Formula Menu}} 
 + 
 +===== “Argument is out of range at row #” Warning =====
 Some mathematical functions can be defined only on a certain interval. For example, square root (''sqrt(x)'') is not defined for negative numbers (all calculations in MagicPlot are made in real numbers, not complex). Hence if the argument of ''sqrt'' is negative, a [[nan|Not-a-Number (NaN)]] is returned. If a NaN value occurs in some part of formula, the result of calculation will also be a NaN, and corresponding table cells will be empty. Some mathematical functions can be defined only on a certain interval. For example, square root (''sqrt(x)'') is not defined for negative numbers (all calculations in MagicPlot are made in real numbers, not complex). Hence if the argument of ''sqrt'' is negative, a [[nan|Not-a-Number (NaN)]] is returned. If a NaN value occurs in some part of formula, the result of calculation will also be a NaN, and corresponding table cells will be empty.
  
 The calculations are not terminated if NaN value occurs in some row(s). The calculations are not terminated if NaN value occurs in some row(s).
  
-In some cases you may want to check if a ''NaN'' values occurs in calculations. MagicPlot shows the warning "//Not-a-Number returned at row #//". This row number is the first row in which ''NaN'' value was returned. MagicPlot also highlights the function or operator which first produces NaN value.+In some cases you may want to check if a ''NaN'' values occurs in calculations. MagicPlot shows the warning "//Argument is out of range at row #//". This row number is the **first** row in which ''NaN'' value was returned. MagicPlot also highlights the function or operator which first produces NaN value.
  
 ===== See Also ===== ===== See Also =====
-  * [[formula|Formula syntax]]+  * [[expressions]]
set_column_formula.txt · Last modified: Mon Jan 18 17:35:05 2021 by Alexander