LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arrays

Hi, I have an array 3x1, and I want to see if it has two elements equal,
three elements equal, or all elements different. More, I'd like to see
which elements are equal (for example, I have [1,3,3], and I want to see
if the elements equal are 1s, 2s or 3s, in my example are 3s).
How can I do?
Thanks

Tycho
0 Kudos
Message 1 of 8
(3,587 Views)
Here is a simple example just using some loops and array functions to do what you are looking for. I did not attach the actual code because I use 7.0 and you probably dont have that, so you can recreate the vi from the image, it will do what you want.
 
Hope this helps!
Jeff


Using Labview 7 Express
Download All
0 Kudos
Message 2 of 8
(3,577 Views)
On a side note, you will need a more complicated architecture than that if you are planning on doing this with an array of more than three. However, for three elements, this works fine, because you can never have more than one number repeating.
Jeff


Using Labview 7 Express
0 Kudos
Message 3 of 8
(3,575 Views)
Here's a simple solution that would not scale well for array with millions of elements. 😉
 
 

Message Edited by altenbach on 11-01-2007 11:31 AM

0 Kudos
Message 4 of 8
(3,570 Views)
Sorry for the misspellings of frequent. Since I am left-handed, the left fingers are sometimes a few nanoseconds faster than the right hand while typing, leading to race conditions. 😄
 
jrpe: 99% of user here use version newer than 7.0, so almost everybody should be able to open your VIs. It is more tricky in my case, because I am using 8.5. Only a small percentage can open these at the moment. Saving for previous adds extra work because I still would not post them without validating in the earlier version first.
0 Kudos
Message 5 of 8
(3,556 Views)


@Tycho wrote:
Hi, I have an array 3x1, ...
I assumed that you have a 1D array with 3 elements. If your input is actually a 3x1 2D array, things need to be modified slightly, of course. 🙂
0 Kudos
Message 6 of 8
(3,528 Views)
jrpe ha scritto:
> Here is a simple example just using some loops and array functions to do what you are looking for. I did not attach the actual code because I use 7.0 and you probably dont have that, so you can recreate the vi from the image, it will do what you want.
>  
> Hope this helps!
>
>
> FP_Example.PNG:
> http://forums.ni.com/attachments/ni/170/281860/1/FP_Example.PNG
>
>
> BD_example.PNG:
> http://forums.ni.com/attachments/ni/170/281860/2/BD_example.PNG

Thankyou very much!
0 Kudos
Message 7 of 8
(3,494 Views)
altenbach ha scritto:
> Here's a simple solution that would not scale well for array with millions of elements. 😉
>  
> <img src="http://forums.ni.com/attachments/ni/170/281864/1/mostfrequent.png">
> &nbsp;Message Edited by altenbach on 11-01-2007 11:31 AM
>
>
> mostfrequent.png:
> http://forums.ni.com/attachments/ni/170/281864/1/mostfrequent.png


Thankyou very much!
0 Kudos
Message 8 of 8
(3,494 Views)