Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Working with arrays

Hello again J

Just a small question

I have 2D array with a lot of points (with more than 200 lines), where first column are X values and in the second column are Y values. I need to separate both columns, and I think this can be done with the function “Index Array”. After that, I need to calculate the difference between each numbers (Xi+1 – Xi) (Xi+2 – Xi+1) ; (Yi+1 – Yi) (Yi+2 – Yi+1) and so on in order to send each resultant value to an electrical motor. My question is, how can I calculate this with an array so big??

I can split small arrays and make the calculation separately, but this would make my program very heavy. I need something like a “For Loop” that after one calculation (Xi+1 – Xi) and (Yi+1 – Yi) send the values to the motor and then makes another calculation (Xi+2 – Xi+1) and (Yi+2 – Yi+1), and so on till file ends.

Hope you can find me a good solution, cos I need help 🙂

Best Regards

Eduardo Gonçalves

 

0 Kudos
Message 1 of 3
(3,288 Views)

You posted to the instrument control board and you should have posted to the appropriate language board. I'm going to assume that you are using LabVIEW.

First, 200 lines is a pretty small array. Second, the 'like a for loop' you want to use is the for loop. A for loop will auto-index an input array and you can add a shift register/feedback loop to remember the last element. Show below is a basic example. You might aslo want to look at the resources for learning LabVIEW basics at http://www.ni.com/academic/lv_training/how_learn_lv.htm.



Message Edited by Dennis Knutson on 04-16-2008 08:29 AM
0 Kudos
Message 2 of 3
(3,273 Views)
Many Thanks Dennis
0 Kudos
Message 3 of 3
(3,245 Views)