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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Creating a vector subset based on criteria

JoeSchepis
1-Newbie

Creating a vector subset based on criteria

Dear fellow MatchCad users,

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

1 ACCEPTED SOLUTION

Accepted Solutions
MikeArmstrong
5-Regular Member
(To:JoeSchepis)

Firstly welcome to the forum.

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

Mike

View solution in original post

3 REPLIES 3
MikeArmstrong
5-Regular Member
(To:JoeSchepis)

Firstly welcome to the forum.

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

Mike

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

MikeArmstrong
5-Regular Member
(To:JoeSchepis)

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

Top Tags