LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

accessing array elements

Solved!
Go to solution

Hello UliBSmiley Very Happy

 

thanks a lot for the helpful vi you have sent for me ,but can you help me more to solve it all?pls?

 

in the vi

the ith element is continuously running ,,i want to calculation for each element separately,

i want to have the 1st element as x ,and subtract it from 2nd,3rd,4th,...And so on ,by this i want to see after how many sample(element),element are repeating,

to make it more clear :

the array elements are the signal samples,i want to determine the period for the signal via labview,

i thought if i can see after how many sample the cycle is repeating ,i can calculate the frequency

 

please have a look at vi below:

0 Kudos
Message 11 of 58
(2,770 Views)

Tinamoli,

 

i just have to step in here to clarify your question:

There is no other purpose in your application than determining the frequency?

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 12 of 58
(2,765 Views)

To UliB,and everybody

 

i am doing a project, which i measure the ECG(electrocardiograph) from a patient and transmit it to the cardiologist(physician) via the internet by webpublishing in labview,

i want to send the parameter as well as the waveform ,like(P wave.QRS complex,....)period and amplitude,.....etc.

 

for this as a test i determined the sine samples  in an  array as shown in vi below ,then i thought if i know that after how many sample(array element),the samples are repeating ,i can calculate the period for one cycle,,

 

 

0 Kudos
Message 13 of 58
(2,755 Views)

tinamoli,

 

sadly you did not answer my question.



tinamoli wrote:

[...]i can calculate the period for one cycle[...] 


 

I take this part i quoted as "Yes, the only thing i want to know is the frequency, at least for now".

And whatever you try to achive by your array-question, it is not the way to get to the frequency.

In order to find out the frequency of a periodic signal of any type, the Fourier-analysis is the way to go in general. There are modification for certain areas, but Fourier is still the reference.

 

LabVIEW gives you many functions at hand to do a frequency-analysis. Most of them can be found in the waveform measurements palette.

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 14 of 58
(2,740 Views)

timamoli,

 

I don't know why you keep asking the same question over and over again about an incorrect technique to determine frequency or period. You were give the correct answer here.

 

Since you are doing biomed, you should look at what is already written and stop trying to reinvent the wheel. You should also spend some time with the tutorials since a lot of your questions are really basic LabVIEW fundamentals.

Message 15 of 58
(2,721 Views)

Hello UliB,

 

You are the only one ,who understood my question,and solved my problem.The vi you have sent to me is really  what i want ,but i need to add one more stage to it.

 

How to access the ith element,for example to keep array[0] (first element ) in a variable,and then array[1] and so on......

 

please,what i found you know how to do this ,and you can help me ??Smiley Sad

0 Kudos
Message 16 of 58
(2,692 Views)

tinamoli wrote:

How to access the ith element,for example to keep array[0] (first element ) in a variable,and then array[1] and so on......


To acceess the i'th element of an array, you use still use "index array", but wire the desired index to the index terminal.

 

If this is in a FOR loop, you can autoindex the array at the loop boundary, and you will get one element with each iteration automatically. First iteration gives array[0], second iteration gives array[1], etc.

 

The output wire will contain array[i], so there is no need for "variables", whatever you mean by that.

 

(Since UliB already showed you all this above, it is not clear what else you need. Still, none of this allows you to easily measure frequency.) 😉

0 Kudos
Message 17 of 58
(2,683 Views)

Hello tinamoli,

 

I have nothing to add to altenbach's reply, but I give you another sample VI.

And... I want to underline altenbach's statement: the wire is the variable.

 

Hope this helps.

Uli

 

0 Kudos
Message 18 of 58
(2,675 Views)

Thank you UliB,

 I really appreciate you for the real help,,,i wish you the bestSmiley Very Happy But what if i want to do this for large number of elements like 100?not to wiring 100 index array ,and do it all in ones like looping.Also as shown below I want to compare the absolute difference of | 1st  element - ith element |is( < or = )to absolute difference of |1st element – 2nd element|,by this I want to figure out in which  ith element  this equation is true ,a method to  count that after how many element to reach this equation which shows the cycle is repeating .
0 Kudos
Message 19 of 58
(2,662 Views)

You always operate on arrays, not on single values. For example, you can do your entire "algorithm" on the array directly and then use search array to find the position of the first TRUE.

 

 

Also your use af a cluster is very misguided. Why is it there???

 

Still, this is NOT how to measure the cycle lenght. trust me. 😉

Message Edited by altenbach on 10-12-2008 03:41 PM
0 Kudos
Message 20 of 58
(2,656 Views)