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

how to find the defference between elements in an array

已解决!
转到解答

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 项奖励
1 条消息(共 18 条)
7,493 次查看

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 项奖励
2 条消息(共 18 条)
7,478 次查看
hope this helps:
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 项奖励
3 条消息(共 18 条)
7,472 次查看
Message Edited by Ravens Fan on 09-01-2009 09:00 PM
0 项奖励
4 条消息(共 18 条)
7,470 次查看

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 项奖励
5 条消息(共 18 条)
7,467 次查看

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 项奖励
6 条消息(共 18 条)
7,455 次查看
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 项奖励
7 条消息(共 18 条)
7,446 次查看
maybe this:
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 项奖励
8 条消息(共 18 条)
7,444 次查看
解答
已被主题作者 adamkse 接受

No need for the outer loop.

Message Edited by Ravens Fan on 09-01-2009 09:53 PM
9 条消息(共 18 条)
7,441 次查看
or maybe this:
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 项奖励
10 条消息(共 18 条)
7,437 次查看