10-08-2008 10:41 AM - edited 10-08-2008 10:45 AM
hello,everybody![]()
i am new in labview,& i need your help please,
i did sampling for a sinewave ,which the value for each sample is stored in an array(point by point),
now i need to access the array element one by one ,since i want to subtract first element by others,one by one in descending order,for example if first element is x,and rest elements are y,y1,y2,y3,y4,........i want to say x-y,x-y1,x-y2,x-y3...............i need to do this to have a count for one period to calculate the frequency.
please,
i need somebody to tell me ,how to subtract the one by one element of arrays which i showed in attachments below:
Solved! Go to Solution.
10-08-2008 11:02 AM - edited 10-08-2008 11:02 AM
Hello tinamoli,
I did not read the document, but I answer your message.
To calculate x-y1, x-y2, x-y3... you can use the attached code.
If you want to access the elements one by one, wire the array to a for loop and use autoindexing.
Hope this helps.
Uli
10-08-2008 11:16 AM
Uli's solution is close, but you might want to wire a "1" instead of a zero to the array subset if I understand your problem description correctly.
tinamoli wrote:....i need to do this to have a count for one period to calculate the frequency.
Can you elaborate a little more on what you really need, because these calculations are probably not the most obvious way to determine a frequency.
We probably have better tools for that. 😄
10-08-2008 11:19 AM - edited 10-08-2008 11:23 AM
hi,uliB
really thanks for your fast reply,,
but unfortunately i couldnt open the vi you sent to me ,since the labview i have is version 8.2 and i couldnt open yours,,
i would be very happy for your further help,
thanks,
10-08-2008 11:26 AM - edited 10-08-2008 11:27 AM
Here's a quick draft.

(Sorry, I was slightly confused in my statement above re. the diagram constant. Uli actually used "delete from array" (where 0 is correct) but labeled it with "array subset". I did not look closely enough at the icon.)
10-08-2008 11:26 AM
Instead of creating a new thread, you should have simply responded to the original one you created and given the details you have here. And, please, do not attach files in such proprietary formats as docx. An lot of people do not have (and have no intention of having) the latest and greatest versions of microsoft software. Try to make your attachments more generic.
10-08-2008 11:43 AM - edited 10-08-2008 11:45 AM
hi altenbach,
please look at the attachment below,there is in array the value of n_samples in one period,i need to build a vi to see how many count for one period,
i mean at which value the cycle repeated,
i hope if it is clear now,
thanks for reply,
10-08-2008 12:11 PM
10-09-2008 03:14 AM
Uli,
what you suggested to me is absolutely right,but:![]()
please show me how to auto indexing the for loop or array ,,,,i couldnt open the vi you sent to me,,,
please help me to figure it out
10-09-2008 04:31 AM
Hello tinamoli,
I saved the VI for LabVIEW 8.0, removed the confusing labels (sorry, altenbach) and I added a small example for autoindexing.
If you wire an array to a for loop, autoindexing should be enabled by default. If you right click a tunnel there is an option to enable/disable indexing.
Hope this helps.
Uli