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
 Forum for Origin C
 Failure of my code
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Yefim Bronfman

USA
Posts

Posted - 07/05/2007 :  11:03:00 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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.

Mike Buess

USA
3037 Posts

Posted - 07/05/2007 :  12:11:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
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