T O P I C R E V I E W |
Chemobob |
Posted - 09/30/2021 : 10:17:10 AM OriginPro 2020b 9.7.5.184 Win 10
Hi everyone,
I am new to coding (in Origin and in general) and I have encountered a seemingly randomly recurring issue that I have failed to find any helpful information on in the documentation or the forums.
I have defined custom (algebraic) functions in an .ogs file in order to use them in combination with the native Integral(...) function of Origin. I have loaded the file into a workspace, compiled, and built it. However, the functions are not reliably accessible. I frequently get the "UNKNOWN FUNCTION" error. I have been able to successfully compile and run the functions from .ogs in the User, User[AutoLoad], and Project folders. But each time I restart origin or change the code in the .ogs it ceases to work. Sometimes, I get a "Nothing to compile, workspace empty, or all files are excluded." error message while building, even if I just loaded the file into the workspace and the "exclude" option is even greyed-out. I noticed that files in the "Project" folder are located in AppData/Local/Temp on the disc, whereas all other folders root to Origin Userfiles, which seems counter-intuitive to me since files in the "Project" folder are re-built upon open and should probably root to permantent file locations.
I would greatly appreciate if anyone has an idea as to where the issue lies. Possibly, I simply misuderstand how workspaces and files work but the fact that I can access the functions at least part of the time suggests that I was doing something right some of the time.
Cheers folks, Julian
*EDIT*
I have been able to bypass the issue by defining the functions in Origin C rather than LabTalk, as .ogs files (even example/template files) wouldn't compile anymore. |
1 L A T E S T R E P L I E S (Newest First) |
YimingChen |
Posted - 10/01/2021 : 09:19:20 AM Hi Julian,
Please refer to this page on defining a global Labtalk function: https://www.originlab.com/doc/LabTalk/guide/On-Starting-Origin#Defining_a_global_function
Labtalk script file .ogs is different from Origin C file, you need to 1) set @global variable to 1 to set the function to be global function. 2) You need to execute the script once to load the function to the memory.
James |
|
|