LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

accessing array elements

Solved!
Go to solution

hello,everybodySmiley Indifferent

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:

 

 

Message Edited by tinamoli on 10-08-2008 10:43 AM
Message Edited by tinamoli on 10-08-2008 10:45 AM
0 Kudos
Message 1 of 58
(12,051 Views)

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

Message Edited by UliB on 10-08-2008 06:02 PM
0 Kudos
Message 2 of 58
(12,033 Views)

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. 😄

Message 3 of 58
(12,023 Views)

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,

Message Edited by tinamoli on 10-08-2008 11:23 AM
0 Kudos
Message 4 of 58
(12,018 Views)

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.)

Message Edited by altenbach on 10-08-2008 09:27 AM
0 Kudos
Message 5 of 58
(12,010 Views)

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.

0 Kudos
Message 6 of 58
(12,009 Views)

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,

Message Edited by tinamoli on 10-08-2008 11:45 AM
0 Kudos
Message 7 of 58
(11,994 Views)
Just wire your waveform to "extract single tone" from the waveform measurement palette. That's all you need. 🙂
Message 8 of 58
(11,968 Views)

Uli,

what you suggested to me is absolutely right,but:Smiley Sad

 

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

0 Kudos
Message 9 of 58
(11,922 Views)
Solution
Accepted by topic author tinamoli

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

0 Kudos
Message 10 of 58
(11,912 Views)