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
 Origin Forum
 debugging e.g. pareto chart

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
tpflanz Posted - 07/11/2005 : 08:26:23 AM
Writing formulas in 7.5 for new columns I frequently don't know how to debug.
e.g. the following code example in the pareto chart entry in this forum didn't work for me:

Data1_D[1]=Data1_C[1];
for(ii=2; ii<=wks.maxrows; ii++)
Data1_D[ii]=Data1_C[ii]+Data1_D[ii-1];

There are no error messages whatsoever - how can I find out how to make it work?

More than that, are there any examples how to manipulate data and detailled examples for programming, more than those already given at the installation? How can I improve my data manipulation skills with Origin?
6   L A T E S T    R E P L I E S    (Newest First)
tpflanz Posted - 07/21/2005 : 05:46:51 AM
cheers Mike,
I didn't know I had to select both lines - now it works
Mike Buess Posted - 07/20/2005 : 10:24:11 AM
At which stage are you running the script?

> If the wks is at stage 4) then nothing will change when you run the script because col(D) already contains the results.

> If the wks is at stage 3) then the script should produce stage 4). These are only reasons for failure that I can think of...

1. The wks Data1 is not active. If that's the case replace wks.maxrows with Data1!wks.maxrows.
2. Column D does not exist.
3. You're not executing correctly from the script window. You must select both lines of script and then press Enter.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 07/20/2005 10:31:05 AM
tpflanz Posted - 07/20/2005 : 08:51:45 AM
O.K. - still the same problem

I follow this procedure:
1) Original Data
A(X): a, b, c, d
B(Y): 2, 3, 1, 4

2) Sort Descending:
A(X): d, b, a, c
B(Y): 4, 3, 2, 1

3) Calculate %:
A(X): d, b, a, c
B(Y): 4, 3, 2, 1
C(Y): 40, 30, 20, 10

4) Cumulate:
A(X): d, b, a, c
B(Y): 4, 3, 2, 1
C(Y): 40, 30, 20, 10
D(Y): 40, 70. 90, 100

5) I open a script window over 'window - script window'
6) I enter:
Data1_D[1]=Data1_C[1]
7) it shows 40 in cell D[1]
8) I enter: for(ii=2; ii<=wks.maxrows; ii++)
Data1_D[ii]=Data1_C[ii]+Data1_D[ii-1]

and nothing happens - what am I doing wrong?
greg Posted - 07/12/2005 : 12:12:50 PM
User Mike Buess is correct that braces are not needed in a for loop executing a single statement.
The code should work provided you have values in column C in the Data1 worksheet.

Mike Buess Posted - 07/11/2005 : 10:24:29 AM
Brackets {} are only necessary for scripts with more than one line. This script should work without the brackets and I'd have to see the context to know why it failed.

You can set echo=1 to have error messages printed to the script window. Debugging tools are also available in CodeBuilder...

Help > Programming > Code Builder User's Guide > Debugger > Debugging LabTalk Scripts

OriginLab's Knowledge Base is the best place to look for programming examples...

http://www.originlab.com/index.aspx?s=9

You can find more examples in these forums and at the Origin WebRing member sites.

Mike Buess
Origin WebRing Member
Thomas M Posted - 07/11/2005 : 09:47:45 AM
I guess you forgot some brakes. Try:

Data1_D[1]=Data1_C[1];
for(ii=2; ii<=wks.maxrows; ii++)
{
Data1_D[ii]=Data1_C[ii]+Data1_D[ii-1];
}

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