取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
1 条消息(共 9 条)
3,986 次查看
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 项奖励
2 条消息(共 9 条)
3,977 次查看
Hello!

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

Best regards.
0 项奖励
3 条消息(共 9 条)
3,969 次查看
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 项奖励
    4 条消息(共 9 条)
    3,967 次查看
    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 项奖励
    5 条消息(共 9 条)
    3,947 次查看
    Yes, thanks for pointing out the mistake, it was an oversight. Here is the corrected version. 🙂
    0 项奖励
    6 条消息(共 9 条)
    3,940 次查看
    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 项奖励
    7 条消息(共 9 条)
    3,936 次查看
    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 项奖励
    8 条消息(共 9 条)
    3,933 次查看
    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 项奖励
    9 条消息(共 9 条)
    3,915 次查看