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
 Data Filtering in Worksheet
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

WiseGriffi

USA
1 Posts

Posted - 04/12/2006 :  5:26:51 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin):
Operating System: XP SP2

I have single data set for A(X) and about 20 data sets for B(Y). This being said I generally have an overlay of 20 plots each with the same X axis. It is my intent to write a macro that will analyze the values in each column to make sure that the values are within an acceptable range. If the values are not within this range then the column needs to be deleted from the worksheet before an average function can be created. I am relatively new to this software and therefore then syntax is a bit foreign to me. Any help or direction to tutorials would be greatly appreciated.

WG

Deanna

China
Posts

Posted - 04/17/2006 :  02:40:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, WG.

Since I am not clear about what the 'acceptable range' is, I am afraid that I cannot provide a complete solution.

I guess you have 21 columns in your worksheet with the first set as X and the rest Y. Then your macro should loop over the Y columns to check if any value in the column are out of the range. If so, the column should be deleted.

Suppose you want all the y values to be not less than 10 and not greater than 30. Then the following code will do the trick.


UpperBound=30;
LowerBound=10;

for (ii=21; ii>=2; ii--)
{
bDelCol = 0;
for (jj=1; jj<=wks.nRows; jj++)
{
if ((col($(ii))[$(jj)]>UpperBound)||(col($(ii))[$(jj)]<LowerBound))
{
bDelCol = 1;
break;
}
}
if (bDelCol==1) del col($(ii));
}




Please change the expression in the parentheses after 'if' to tell Origin what kind of values are out of the acceptable range. I hope this will help

Deanna
OriginLab GZ Office

Edited by - Deanna on 04/17/2006 02:41:41 AM

Edited by - Deanna on 04/17/2006 02:43:40 AM
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