From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.


Showing results for 
Search instead for 
Did you mean: 

Acess elements of arrays in for loop


I have a signal ( currently it is simulated ) and I want to detect the peaks in that signal. I want to display a graph of this signal in realtime ( x - axis is time , y - axis is signal ) Also, I have to mark each peak as soon as it is detected ( i am using cursors for this ). Also, I have a text file which contains some names corresponding to time. When each peak is detected, according to the timing in text file ( with certain deviation ), that Peak has to be marked with the corresponding  name in text file ( corresponding to the time at which the peak was detected).  Also, I need to rotate the text by 90 deg, of that marked peak's cursor.

I have detected the peaks and all the information of that peaks is stored in an array. I am facing a problem while marking these detected peaks. The problem is that once second peak is detected , first peak gets marked. I have used shift registers but still cannot solve this issue. Also, I cannot rotate the cursor text by 90 deg.

I am attaching my VI, it is very crude as i am still working on it.

Any correction in the VI attached which might help me to achieve what I am upto will be appreciated.


0 Kudos
Message 1 of 3
Looking at your code, I noticed that each time you send data to the "peaks subvi" (missing in this attachment) in the “For loop”, the pt by pt peaks detector sets the status of the "Boolean" indicator using a local variable.
Though the status of the "Boolean" local variable might change each iteration of the “For loop”, the case structure will not execute until the last iteration of the “For loop” as it depends on one of the outputs of the "peak subVI" (Empty Peaks 5). Only the last value written to the Boolean local variable actually executes.
If you intend to execute the case structure each iteration of the “For loop”, then you need to place the case structure within the “For loop”. In fact, using local variable to pass data within the “While loop” is redundant. Just create a Boolean indicator for the peaks detector status in “For loop” and pass the data with wire.
0 Kudos
Message 2 of 3


If youare going to post code to the forum, it might be a good idea to write it with a licensed copy of LabVIEW and not a bootleg one.Smiley Mad

0 Kudos
Message 3 of 3