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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Script running leads to Crash wenn i>10k??

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
hawu001 Posted - 10/09/2018 : 4:04:39 PM
Origin Ver. and Service Release (Select Help-->About Origin): b9.5.1.195
Operating System:Win10

Hi fellas,

I'm relatively new in this field and I was actually excited by using the LabTalk-Script, cuz it could really save a lot of time sometimes.

But there's just a new problem: every time I run the code, it ends up with a crash of the programme.

Description of my task at first:

I have 4 columns of Data: let's say A, B, C, D. Col(C) is for the measured data, and Col(B) is the "time interval" of the measured Data, which is very small (like 0, 0.2, 0.4, 0.6,..., 10000) and therefore has a lot of rows. The Col(A) is another "time interval" which is in comparision with Col(B) very wide(like 0, 100, 200, 300,..., 10000) and therefore has less rows.

What I need is to select the value of Col(C) (measured data) after the wider time interval and paste it into Col(D).I.e. when the value of Col(B) is found in Col(A), the value in the same row of Col(C) should be copied and pasted into Col(D).

The script is pasted as following:
==========================================================
for( i=1,j=1 ; i<=40 && j <=80 ; j++ )
{
range rr=Col(D)[$(i)];
aa=Col(A)[$(i)];
bb=Col(B)[$(j)];
cc=Col(C)[$(j)];
if($(bb)==$(aa))
{rr=$(cc);
rr[1]=;
i++;
}
else
{continue;
}
}
==========================================================
When i and j are less than 80, it seems actually good. The goal can be reached. But since I have really a lot of rows of data (more than 300k), the code will be collapsed at about 10k...

My question is, if anyone has the same experience? Can I make the LabTalk-Script somehow more efficient?

My Laptop has i7 CPU, 8G memory, HDD. But obviously I wouldn't buy a new one only for solving this problem.

Thanks a lot in advance to the community!

Best regards
Howie


LabTalk ist eine Quälerei. --- J. S. Bach
6   L A T E S T    R E P L I E S    (Newest First)
hawu001 Posted - 10/30/2018 : 06:41:42 AM
Hi CP,

thank you a lot!! It's really much easier and more effectiver!

Best Regards,
Howie

quote:
Originally posted by cpyang

Just put column formula into col(D) as


table(B,C,A)





Most things can be done with column formula and then you just save the book as template, and write only the smallest amount of code.

CP

CP




LabTalk ist eine Quälerei. --- J. S. Bach
cpyang Posted - 10/10/2018 : 9:21:54 PM
Just put column formula into col(D) as


table(B,C,A)





Most things can be done with column formula and then you just save the book as template, and write only the smallest amount of code.

CP

CP
hawu001 Posted - 10/10/2018 : 06:59:00 AM

quote:
Originally posted by yuki_wu

Hi Howie,

Using wxt X-Function (menu: Worksheet: Worksheet Query) will be faster:
wxt test:="col(A)==col(B)" ow:=<new>;

https://www.originlab.com/doc/X-Function/ref/wxt
https://www.originlab.com/doc/Origin-Help/Wks-Query

Hope it helps.

Regards,
Yuki
OriginLab



This is what I actually want to get:


LabTalk ist eine Quälerei. --- J. S. Bach
hawu001 Posted - 10/10/2018 : 06:56:38 AM




quote:
Originally posted by yuki_wu

Hi Howie,

Using wxt X-Function (menu: Worksheet: Worksheet Query) will be faster:
wxt test:="col(A)==col(B)" ow:=<new>;

https://www.originlab.com/doc/X-Function/ref/wxt
https://www.originlab.com/doc/Origin-Help/Wks-Query

Hope it helps.

Regards,
Yuki
OriginLab


LabTalk ist eine Quälerei. --- J. S. Bach
hawu001 Posted - 10/10/2018 : 06:53:51 AM
Hi Yuki,

thanks for your hints, but in the if sentence, I have to compare two columns with different length (40 and 80, as shown in the graph).

That's also why I used i and j.

Would wxt still work?


quote:
Originally posted by yuki_wu

Hi Howie,

Using wxt X-Function (menu: Worksheet: Worksheet Query) will be faster:
wxt test:="col(A)==col(B)" ow:=<new>;

https://www.originlab.com/doc/X-Function/ref/wxt
https://www.originlab.com/doc/Origin-Help/Wks-Query

Hope it helps.

Regards,
Yuki
OriginLab




LabTalk ist eine Quälerei. --- J. S. Bach
yuki_wu Posted - 10/09/2018 : 10:55:09 PM
Hi Howie,

Using wxt X-Function (menu: Worksheet: Worksheet Query) will be faster:
wxt test:="col(A)==col(B)" ow:=<new>;

https://www.originlab.com/doc/X-Function/ref/wxt
https://www.originlab.com/doc/Origin-Help/Wks-Query

Hope it helps.

Regards,
Yuki
OriginLab

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000