From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare 1D array to a table and fail for unwanted values

Hi There, looking for a little bit of help if possible.

 

I am taking some measurements from my signal analyser and from the resultant measurements separating out the frequency components into a 1D array which seems to be the easiest part... in the 1D array I should always have the main frequency component, but also a number of spurious harmonics, however, I have a list of five harmonics that are acceptable, all others would result in a failure.

 

So essentially I want to take my 1D array of strings, compare it with my list of acceptable values, and return a fail if anything is outside of the list.

 

TIA

 

 

 

LABOR OMNIA VINCIT
0 Kudos
Message 1 of 5
(1,094 Views)

Nested For Loops... Outer one iterates over each value of your 1D Array and inner one iterates over the array of acceptable values.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 2 of 5
(1,070 Views)

Hi Andrew thanks for your response.

 

vi attached with where I got to...

 

I've used a for loop with a case structure containing a "search 1D array", this is then returning an array containing  index of elements... so what I want now is if the output array contains a '-1', i.e. one of the input elements did not match, then it results in a fail, is there an easy way to search the array for the -1?

LABOR OMNIA VINCIT
0 Kudos
Message 3 of 5
(1,016 Views)

Yes, just do it within your For Loop while you are indexing though... See below. Also, you've already told your For Loop how many times to run by indexing over your 3 element array, you don't need to take the array's size and wire it to N too. That's redundant.

Compare 1D Array.png

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 4 of 5
(1,009 Views)
 

I did it in the following way in the end, but thanks for your help, very much appreciated.Untitled.png

LABOR OMNIA VINCIT
0 Kudos
Message 5 of 5
(1,000 Views)