LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare the array size?

Hello!

Now we have the following problem: We have an array of a cluster and in this cluster we have an array. We need to compare the length between the array named "sampelnr"...

If they are not equal length we need to get the "signalname" from the array which is the smallest. The "Array" could be of different length from time to time... does anyone have any tip for us?

See the attached VI. Best regards and thank you!
0 Kudos
Message 1 of 9
(3,059 Views)
I think that this is what you are wanting to do. Within the loop it compares each value of the array length to the previous value. If any are different a flag is changed to False and maintained through the rest of the loop. At loop completion if the flag is False it finds the minimum length, gets the element number, and then selects the appropriate element from the signalname array.
0 Kudos
Message 2 of 9
(3,050 Views)
Hello!

Thank you very much for yoor help! We will have a look at the VI...

Best regards.
0 Kudos
Message 3 of 9
(3,042 Views)
There will be more to your problem, because you don't tell what the output should be if:
  • all elements are the same lenght
  • more than one array has a smallest size (e.g. if we have the following lenghts [4,4,5,6,7], the first two have smallest size. Do you want both names?).

    Attached is a small example that shows two possible interpretations, pick the more suitable for your case:
  • In the upper (blue) part, it assumes that there is only one "smallest" array.
  • In the lower (red) part, it shows how to get all names where the array is equal to the smallest size.

    Message Edited by altenbach on 04-18-2005 08:55 AM

  • 0 Kudos
    Message 4 of 9
    (3,040 Views)
    Hello!

    Thank you very much for your help! We have had a look at your attached VI. The lowest one is the one that is closest for us to choose. There is one problem... if two signalarrays is the smallest length, (for example if hello has the length of four, and the two others has the length of two) then we would like both of them to be shown. In this case we see two but it is the same signalname twice... (it is the last one). Could this be because of the shiftregister?

    Thank you again and best regards.
    0 Kudos
    Message 5 of 9
    (3,020 Views)
    Yes, thanks for pointing out the mistake, it was an oversight. Here is the corrected version. 🙂
    0 Kudos
    Message 6 of 9
    (3,013 Views)
    Hello again 🙂

    What shall one do if we have like this = sizes of the arrays (3,4,6)? Then we want the first and the second signalname to be shown. Can one compare even the element that is between the max and min? Hope you do not mind our questions 🙂

    Thank you again! Best regards.
    0 Kudos
    Message 7 of 9
    (3,009 Views)
    Hello!

    Thank you again for your help! We have had a look at your VI. If we have this case: if hello
    The problem we have is that if one or moore array size differentiate from the largest. For example (8,8,8,4,5,8,8,8,8,8). Then we want the signalname for the arrays that has the sizes 4 and 5. And if all of
    them has (for example) the size 8 noone need to be shown. The sizes could be any number... does this make sense?

    Thank you and best regards.
    0 Kudos
    Message 8 of 9
    (3,006 Views)
    Yes, this can easily be done with a trivial modification. You just need to list all files where the size is smaller than the maximum size. See attached.
    0 Kudos
    Message 9 of 9
    (2,988 Views)