1.2.4 Functions

Global Functions

Origin C provides many global functions for performing a variety of tasks. These global functions fall into twenty-six categories.

  1. Basic IO
  2. Character and String Manipulation
  3. COM
  4. Communications
  5. Curve
  6. Data Conversion
  7. Data Range
  8. Date Time
  9. File IO
  10. File Management
  11. Fitting
  12. Image Processing
  13. Import Export
  14. Internal Origin Objects
  15. LabTalk Interface
  16. Math Functions
  17. Mathematics
  18. Matrix Conversion and Gridding
  19. Memory Management
  20. NAG
  21. Signal Processing
  22. Spectroscopy
  23. Statistics
  24. System
  25. Tree
  26. User Interface

Please refer to the Global Functions section for a complete list of functions with examples.

User-Defined Functions

Origin C supports user-defined functions. A user-defined function allows Origin C programmers to create functions that accept their choice of arguments and return type. Their function will then operate on those arguments to achieve their purpose.

The following creates a function named my_function that returns a double value and accepts a double value as its only argument.

double my_function(double dData)
{
	dData += 10;
	return dData;
}

The following code snippet shows how to call the above function.

double d = 3.3;         // Declare 'd' as a double value
d = my_function(d);     // Call the above function
out_double("d == ", d); // Output new value of 'd'

Origin C functions can also be called from LabTalk.

d = 3.3;            // Assign 3.3 to 'd'
d = my_function(d); // Call the above function
d=;                 // Output new value of 'd'