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
 Forum for Origin C
 Failure of my code

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
Yefim Bronfman Posted - 07/05/2007 : 11:03:00 AM
I wrote a simple script to automate a task in origin, but the script fails after the first few columns. I'm rather confused.

The data looks like this:
x1 y1 x2 y2 x3 y3 ...... col(45)
1
2
3
...
3600

*not every column goes down to 3000
column 45 is special, in that it's a place to hold some values.
for(i=2;i<45;i+2){
max = -100;
for(j=1;j<3600;j++){
if(col($(i))[j]>max){
max = col($(i))[j];
}
}
col($(i)) /= max;
col($(i)) = 1 - col($(i));
integrate col($(i));
col(45)[i/2] = integ.area;
}

The preceeding code works for the first 10y columns, but then it stops working until the last column.
There is a total of 44 columns, x and y alternatingly.

Please help me debug it, thanks.
1   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 07/05/2007 : 12:11:45 PM
I suspect we'll need to see the worksheet before we can supply an answer. However, in the mean time I can give you a much faster way to obtain the maximum value of a column. Furthermore, it's independent of the number of rows in the column...

for(i=2;i<45;i+=2) {
sum(col($(i)));
col($(i)) /= sum.max;
col($(i)) = 1 - col($(i));
integrate col($(i));
col(45)[i/2] = integ.area;
};

Mike Buess
Origin WebRing Member

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