The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Inconsistent compiling / "Unknown Function"
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Chemobob

Germany
1 Posts

Posted - 09/30/2021 :  10:17:10 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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.

Edited by - Chemobob on 10/01/2021 07:25:40 AM

YimingChen

1664 Posts

Posted - 10/01/2021 :  09:19:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000