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
 Error code 165
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ds755

57 Posts

Posted - 09/14/2019 :  7:03:38 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

I am running a LabTalk script in which the fitLR X-function crashes inexplicably with the following error message:

Unknown error; function return error code: -165

Could you please help me figure out what it means?

The same happens if I use fitpoly. I get the error: "Failed to perform fitting".

The strange thing is that if I copy and paste these script lines into the command line, after the script finishes, they work fine.

Origin Ver. and Service Release (Select Help-->About Origin): Origin 2019
Operating System: Windows 8.1

Edited by - ds755 on 09/14/2019 7:04:18 PM

cpyang

USA
1406 Posts

Posted - 09/14/2019 :  9:42:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That was an internal error code, when input data has too few points, and in the case of FitLR, if input less then 2 data points.

#define STATS_ERROR_TOO_FEW_DATA_PTS		-165

Did you put your script in an ogs file so we can avoid any issue on how the script is executed? I suspect this has something to do with the context of the script execution. You can add some debugging code to check the dataset.

CP
Go to Top of Page

ds755

57 Posts

Posted - 09/14/2019 :  10:00:36 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi CP,

The script is in an ogs file.

You're right. The first line of the code below is mysteriously not executed.

col(G)=-log(col(C));
fitLR iy:=[%H]1!(2,7)[1:7] oy:=col(I);


col(G)[O]$ = "-log(col(C))"; also does not make a difference.

Edited by - ds755 on 09/14/2019 10:12:55 PM
Go to Top of Page

ds755

57 Posts

Posted - 09/14/2019 :  10:29:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Problem solved.

I had to convert all the [O] string/formula assignments to mathematic assignments.

It looks like col(G)[O]$ = "-log(col(C))"; is executed at the end of the script while col(G) = -log(col(C)); is executed immediately.

That's very strange.
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 09/14/2019 :  11:54:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Maybe you have an extra ";"

See
https://www.originlab.com/doc/LabTalk/guide/Using-Semicolons-in-LT

"Leading Semicolon for Delayed Execution"

Before Origin 2018, this can easily happened if you just have an extra ";" but after 2018, this notation can only work in the ";" is at the beginning of a line.

CP
Go to Top of Page

ds755

57 Posts

Posted - 09/15/2019 :  1:59:50 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Well, I use Origin 2019 so it can't be that.

I encountered this issue in the past as well (and even posted it here in the forum).

https://my.originlab.com/forum/topic.asp?TOPIC_ID=42070

It seems that [O] formulas are recalculated at the end of the script and not on the fly.

Edited by - ds755 on 09/15/2019 2:03:29 PM
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 09/15/2019 :  2:34:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Sorry, I didn't realized that you were setting an Fx formula with [O].

YES, setting the formula using [O] may not execute it immediately, since formula is typically executed when input has changed. I tried something simple and cannot see the problem. I tried putting values into col A and run

col(B)[O]$="A+1";
col(B)[3]=;

and I do see the values in col(B) updated, so this may depends on something else.

Since you are putting things in code anyway, certainly better to just execute with direct code.

CP
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