Code Export¶
The Code Generation option in the control panel or File menu of the Curve-Fit Graph is used to write generated code for the current curve-fit or AR model equation. Code can be generated for all of TableCurve 2D's built-in equations and for all AR model fits.
Supported Languages¶
You can export any TableCurve 2D built-in Curve-Fit equation or AR model to program code in the following languages:
- C (double)
- C (long double)
- FORTRAN 77
- FORTRAN 90
- QBASIC
- Visual BASIC
- Turbo PASCAL
Code Generation¶
You have the option of generating only the function code, or a full code option that contains simple calling code to test the function. The Full Test Code option writes the function, any auxiliary function such as the error function or the Chebyshev or Fourier series evaluators, and simple calling code to test the equation. The Function Code Only omits the code that tests the function.
You must specify the name of the function, subroutine, or procedure for the curve-fit equation. After the file is written, you are presented with a Generated Code Display. The generated code will normally contain 15-16 digits precision and will use double precision (64-bit) variables. The C (long double) and PASCAL options will use long double precision (80-bit) and will be written to 19 digits precision.
- The Visual Basic full test code is specific to Microsoft Visual Basic. The TableCurve 2D Visual Basic code generation produces a Visual Basic Form [.FRM] file.
User-Defined Functions¶
While code is not generated for user-defined functions, TableCurve 2D will write the current UDF into the generated code as it appears in the program. This should assist you in the manual coding that is required. If your UDF uses a special function such as a Bessel or one of the statistical functions, you will have to supply your own version of the function.
No Constraint Code¶
Note that this generated code will contain only the native mathematical computation. There will be no conditional statements to manage undefined regions. For non-linear equations, however, constraints will appear as comments.
Adding a Visual Basic Module to an Excel Sheet¶
If you are using a later version of Excel that supports VBA (Visual Basic for Applications), you can add a BASIC module containing the curve-fit equation to the Excel spreadsheet.