LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to find the defference between elements in an array

Solved!
Go to solution

hi guys,

 

this is probs an easy one for you but how can you find the diffence between all elements in an array?

 

e.g array = 1 2 3 4 5 6

 

so difference between 1 and two is 1, difference between 1 and 3 is 2. all the way to trough to the differece between 6 and x is x etc.

 

i have been trying to use shift registers but cant quite get it.

 

Thanks

Message Edited by adamkse on 09-02-2009 01:18 AM
0 Kudos
Message 1 of 18
(6,841 Views)

Try a Rotate 1-D array.  (It's in the array functions).  I think it will do just what you want.  If it doesn't, let me know.

 

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 2 of 18
(6,826 Views)
hope this helps:
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 3 of 18
(6,820 Views)
Message Edited by Ravens Fan on 09-01-2009 09:00 PM
0 Kudos
Message 4 of 18
(6,818 Views)

You need to clarify your question.

 

Do you simply want to subtract indexes of  same array or indexes of different array.

 

I suppose you mean you have an array, and you want to be able to subtract one element from another element of the same array?

 

If that is the case, you can simply have two controls, and connect them to the index array function.

0 Kudos
Message 5 of 18
(6,815 Views)

Thanks for the fast replys guys.

 

to try and clarify what I am wanting to do: I want to subtract one element from all others then move to the next element then subtract all others, all the way though to the end. This is all within the same array.

 

Harold's idea was close but only works for the first element.

Message Edited by adamkse on 09-02-2009 02:27 AM
0 Kudos
Message 6 of 18
(6,803 Views)
you could replace my constant in the index array with a control and step through the array and it should subtract properly
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 7 of 18
(6,794 Views)
maybe this:
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 8 of 18
(6,792 Views)
Solution
Accepted by topic author adamkse

No need for the outer loop.

Message Edited by Ravens Fan on 09-01-2009 09:53 PM
Message 9 of 18
(6,789 Views)
or maybe this:
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 10 of 18
(6,785 Views)