LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

match an array element to a list

hi
this is more a programing question than a labview one but i'll be happy to get an answer.
I have a program that gets a list of wavelengths from a wave length meter and then I want to check how far are my wavelengths(WL) from the official standart for DWDM WL.
the problem is that due to noise in my laser some peaks are sometimes missing and some times the first two or three WL are not measured and yet I want my VI to attach the right WL measured to to the right WL in the list.
any ideas how to do this?
attached is my VI that now uses a method that finds the first WL associated to the WL list and then adds an index to all the following WL.
0 Kudos
Message 1 of 8
(3,235 Views)

Perhaps you should explain more about your vi.  What is the ITU Array?  What is "off itu WL"?  I am assuming your Lambda array is your array of measured wavelengths.  Your explanation of your method is confusing.

If you have missing peaks, you need to identify those peak values, and insert them into the array using Insert Into Array.  Then you could do an array comparison for all the elements to see how far off your measurements are.  Of course your inserted values would not be a true measurement.

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 8
(3,209 Views)

OK
"ITU array" is a list of the official WL that my WL are supposed to match.
"ITU Wavelength" is the official WL I am looking at right now.
"off itu WL" is the WL I extracted from my array of WLs .
in the next VI "ITU Wavelength" and "off itu WL" are compared and the difference between them calculated.
I'll give an example:
lets say the ITU array is 1,2,3,4,5,6,7
and the lambda array is 0.8,1.85,2.1,3.05,3.95,5.02,6.2,6.98
the VI will recognize 0.8 from the array as the first element. "ITU Wavelength" and "off itu WL" will return: 1, 0.8 respectably. 
on every running of the VI "WL num" and "ITU index" will increase and return the following "ITU Wavelength" and "off itu WL".
The problem is that sometimes my first element can be 1.23 and then "threshold 1D array " will return nothing. Another problem occurs when one of the elements is missing; all the WL afterwards will be shifted by one place. It is hard to recognize the missing WL because I do not know its exact value.

thanks
amos

Message Edited by amose on 12-08-2005 01:09 AM

0 Kudos
Message 3 of 8
(3,196 Views)

Hi Amos,

         Looks like a fun problem ( bet "some" analysis VIs will come in handy) not clear how Lambda varies from ITU, though


@amose wrote:

lets say the ITU array is 1,2,3,4,5,6,7
and the lambda array is 0.8,1.85,2.1,3.05,3.95,5.02,6.2,6.98


Does this imply that

the 1.85 (measured) would (or should) be associated with 2, and

the 2.1 (measured) would or should be associated with 3?

 cheers!
When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 4 of 8
(3,189 Views)

1. That's the fun with physics. Your system always does what you want (in an order of magnitudeSmiley Happy). My system should have shown the same as the ITU list but it is only close to it.

2. Sorry Dynamic my mistake. The 2.1 is unnecessary.

The example should have been:

lets say the ITU array is 1,2,3,4,5,6,7
and the lambda array is 0.8,1.85,3.05,3.95,5.02,6.2,6.98

amos

Message Edited by amose on 12-08-2005 03:29 AM

0 Kudos
Message 5 of 8
(3,189 Views)
You could try this:  Compare each element between the two arrays.  If you find one element to be off by a certain amount, it means that a value was missed, and you could insert the value into the first array.  For example, lets say your measured array is 1.3, 2.1, 2.9, 4.9, 6.1, and the standard array is 1,2,3,4,5,6.  Right away you can tell by the number of elements that the first array has a missing value.  When comparing, 1.3 is close to 1, 2.1 is close to 2, 2.9 is close to 3, but 4.9 is too far away from 4 (closer to 5).  So insert a 4 into the first array at that point.  Then compare 4 to 4, and continue with comparing 4.9 to 5 and 6.1 to 6.  Does this make sense?
- tbob

Inventor of the WORM Global
Message 6 of 8
(3,174 Views)
Hi amose, tbob

@amose wrote:

2. Sorry Dynamic my mistake. The 2.1 is unnecessary.

The example should have been:

lets say the ITU array is 1,2,3,4,5,6,7
and the lambda array is 0.8,1.85,3.05,3.95,5.02,6.2,6.98


In that case - and with the afore mentioned disclaimer, that is, "some" vi may alread exist that does analysis sort'a-kind'a like what tbob described... 

... how about indexing through the ITU values, and for each ITU value, find the best measurement-match.  If best match differs from the ITU value by more than some amount (like half an ITU increment) that wavelength could be missing in Lambda. Smiley Surprised

(?)

When they give imbeciles handicap-parking, I won't have so far to walk!
Message 7 of 8
(3,161 Views)
thanks for all the good ideas.
amos
0 Kudos
Message 8 of 8
(3,135 Views)