cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

SOLVED
Highlighted
Newbie

## Creating a vector subset based on criteria

I have several data sets (mechanical torque test data in Excel files) that I need to process, one file at a time. Each file is initially read into a matrix and then three vectors are extracted by columns. I want to calculate mean, median, max and standard deviation of the data. In the attached graphic you can see that there are many zero readings. I'd like to calculate those values while excluding the zeros, or say by excluding the values below some criteria that I choose later.

I am thinking the best way to do this is to create 'a program' which will assign a new vector with the values which pass my criteria test (ie, zeros removed). Since I'm calculating based on the results, I can't have NaN values in the vectors. Unfortunaelty I'm too novice in MathCad to understand the programming toolbar.

I already have the data import, vector statistics and plotting working. Can anyone offer suggestions on programming?

Best regards,

Joe

Tags (6)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

## Re: Creating a vector subset based on criteria

Firstly welcome to the forum.

Have a look in the attached worksheet. A couple of examples which should do the trick.

Mike

3 REPLIES 3
Highlighted

## Re: Creating a vector subset based on criteria

Firstly welcome to the forum.

Have a look in the attached worksheet. A couple of examples which should do the trick.

Mike

Highlighted

## Re: Creating a vector subset based on criteria

Mike,

Thanks for your reply. After reading through your examples and trying them out, I found that the "Extract" function you used worked for my purposes. I was playing with the "Threshold" function but at first I got a MathCad error telling me that my passed value "low" is unitless but should have units of "potential." Strange. I re-entered the function and it works fine.

So, the good news is that I now have a down-selected vector based on a passed criteria. Everything is happy.

Thanks again and regards,

Joe

Highlighted

## Re: Creating a vector subset based on criteria

 After reading through your examples and trying them out, I found that the "Extract" function you used worked for my purposes. I was playing with the "Threshold" function but at first I got a MathCad error telling me that my passed value "low" is unitless but should have units of "potential." Strange. I re-entered the function and it works fine.

No problem. These are decent functions which have been passed in the forum many times. They also give a good indication of how to write functions similiar.

Mike

Announcements